Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#433] connects nation community (connects #433) #440

Merged
merged 40 commits into from
Apr 5, 2018

Conversation

Rupesh87
Copy link
Contributor

No description provided.

@@ -29,10 +29,10 @@
<p class="menu-item-text" *ngIf="notification.doc.status==='unread' && notification.doc.link ===''">
{{notification.doc.message}} {{notification.doc.time | date: 'MMM d, yyyy'}}
</p>
<p *ngIf="notification.status!=='unread' && notification.doc.link">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes from the Duplicate notification commit should be removed as they are for a different PR. Please make sure to begin branches from the master branch.

@Rupesh87
Copy link
Contributor Author

Rupesh87 commented Mar 7, 2018

@paulbert @dogi when connecting between nation and community we use the same data in configurations and communityregistrationrequests databases. Do we want to replicate data in between or make them different entities with different ID?

@paulbert
Copy link
Member

paulbert commented Mar 9, 2018

@Rupesh87 I think different entities. That way we avoid conflicts if the uuid assigned locally to the configuration is the same as one that already exists on the nation in communityregistrationrequests. An unlikely scenario, but it's easy for us to avoid.

Also, please make sure to fix linting errors before pushing:

image

community.registrationRequest = 'accepted';
this.couchService.get('_users/_all_docs?include_docs=true')
.subscribe((data) => {
data.rows.map(data => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block includes 4 levels of nested CouchDB requests/subscribes, 3 of which are nested in a map.

  1. Please do not loop over even 1 couch request. Use _bulk_docs instead.
  2. Do not nest subscribes. Create different functions and/or use the switchMap rxjs operator to clean this up.

@Rupesh87 Rupesh87 removed the WIP label Mar 15, 2018
@empeje
Copy link
Contributor

empeje commented Mar 16, 2018

@@ -14,8 +14,8 @@ export class CouchService {
return Object.assign({}, this.defaultOpts, opts) || this.defaultOpts;
}

private couchDBReq(type: string, db: string, opts: any, data?: any) {
const url = this.baseUrl + db;
private couchDBReq(type: string, db: string, opts: any, data?: any, parentLink?: any) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include parentLink in the opts variable and adjust the rest of the code to match. I'd rather we have one optional parameter for the methods available on the CouchService.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulbert httpRequest is using opts so we used another optional (parentLink). If we are going to include parentLink inside opts then we have to remove parentLink while requesting. so which approach we should follow???

'password': this.loginForm.value.password,
roles: [],
'type': 'user',
'isUserAdmin': true,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isUserAdmin should only be set on the local user, not the parent user

this.couchService.post('communityregistrationrequests', configuration, {}, configuration.parent_domain)
]).debug('Sending request to parent planet').subscribe((data) => {
userDetail['request_id'] = data[3].id;
this.couchService.put('/_users/org.couchdb.user:' + this.loginForm.value.username,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use switchMap rather than nesting observables.

@paulbert
Copy link
Member

paulbert commented Mar 23, 2018

A few things noted today:

  • User needs to be logged out of both child and parent when logout clicked.
  • User needs to renew session with parent. Otherwise viewing parent resources will not work after session resets (10 minutes).
  • We should handle the situation when the parent is not accessible (someone has access to the nation because they are on the same network, but that network does not have access to the internet & center). We will also need to allow the user to log into the center when it becomes available.
  • Password changes need to be synced with all accounts (need to handle the above case for this as well)

I think these should be dealt with in a new issue, but if any of these can be fixed quickly feel free to add them in this PR.

@paulbert
Copy link
Member

Just raising a question: do we want to add a document to login_activities of the parent (nation) in addition to the child?

We'll have to make some adjustments if so, notably the ids will not match so if we sync the two dbs we will have duplicate sessions recorded. Also we should have a field that stores the nation/community name in the session so we know what the user logged into.

@Rupesh87
Copy link
Contributor Author

Yes, we think we need to maintain login activities in parent environment as well. But it is not necessary to do that. So, what’s your plan? Should we remove the login activities to the parent planet ?

Copy link
Member

@paulbert paulbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was poorly merged with the changes to the master. The service should not be reliant on the route, and services should not directly affect a template.

@paulbert paulbert force-pushed the 433-connects-nation-community branch from 67083a5 to fa3b24e Compare April 4, 2018 19:24
@paulbert paulbert merged commit c7ebf31 into master Apr 5, 2018
@lmmrssa lmmrssa deleted the 433-connects-nation-community branch April 10, 2018 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants