Skip to content

Commit

Permalink
Fix handling of public access rights of Calendars
Browse files Browse the repository at this point in the history
Fixes #4344
  • Loading branch information
cgx committed Dec 18, 2017
1 parent e6e5e07 commit de91b57
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 5 deletions.
5 changes: 5 additions & 0 deletions UI/Common/UIxUserRightsEditor.m
Expand Up @@ -57,6 +57,11 @@ - (void) dealloc
[super dealloc];
}

- (void) setUid: (NSString *) _uid
{
ASSIGNCOPY (self->uid, _uid);
}

- (NSString *) uid
{
return uid;
Expand Down
2 changes: 1 addition & 1 deletion UI/Scheduler/UIxCalUserRightsEditor.m
Expand Up @@ -124,7 +124,7 @@ - (void) updateRights: (NSDictionary *) newRights

if ([currentValue isEqualToString: @"None"])
[self removeAllRightsFromList: rightsForType];
else
else if ([rightsForType containsObject: currentValue])
[self appendExclusiveRight: [NSString stringWithFormat: @"%@%@",
currentType, currentValue]
fromList: rightsForType];
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/ContactsUI/UIxContactFoldersView.wox
Expand Up @@ -554,7 +554,7 @@
</div>
</script>

<!-- modal for addressbook sharing options -->
<!-- modal inner content for acl editor -->
<script type="text/ng-template" id="UIxUserRightsEditor">
<var:component className="UIxContactsUserRightsEditor" />
</script>
Expand Down
5 changes: 5 additions & 0 deletions UI/Templates/SchedulerUI/UIxCalMainView.wox
Expand Up @@ -583,6 +583,11 @@
<var:component className="UIxCalUserRightsEditor" />
</script>

<!-- modal inner content for anonymous acl editor -->
<script type="text/ng-template" id="UIxAnonymousUserRightsEditor">
<var:component className="UIxCalUserRightsEditor" const:uid="anonymous" />
</script>

<!-- modal for calendar import -->
<script type="text/ng-template" id="UIxCalendarImportDialog">
<md-dialog flex="40" flex-xs="100" label:aria-label="Import Calendar">
Expand Down
2 changes: 1 addition & 1 deletion UI/Templates/UIxAclEditor.wox
Expand Up @@ -84,7 +84,7 @@
<var:string label:value="Subscribe User"/>
</md-checkbox>
</var:if>
<div ng-include="'UIxUserRightsEditor'">
<div ng-include="acl.templateName(user)">
<!--
Load ng-template #UIxUserRightsEditor from main module wox. Inner wox templates are:
- UI/Templates/ContactsUI/UIxContactsUserRightsEditor.wox
Expand Down
11 changes: 9 additions & 2 deletions UI/WebServerResources/js/Common/AclController.js
Expand Up @@ -6,8 +6,8 @@
/**
* @ngInject
*/
AclController.$inject = ['$timeout', '$mdDialog', 'Dialog', 'usersWithACL', 'User', 'folder'];
function AclController($timeout, $mdDialog, Dialog, usersWithACL, User, folder) {
AclController.$inject = ['$document', '$timeout', '$mdDialog', 'Dialog', 'usersWithACL', 'User', 'folder'];
function AclController($document, $timeout, $mdDialog, Dialog, usersWithACL, User, folder) {
var vm = this;

vm.users = usersWithACL; // ACL users
Expand All @@ -16,6 +16,7 @@
vm.selectedUid = null;
vm.userToAdd = '';
vm.searchText = '';
vm.templateName = templateName;
vm.userFilter = userFilter;
vm.closeModal = closeModal;
vm.saveModal = saveModal;
Expand All @@ -28,6 +29,12 @@
vm.confirmation = { showing: false,
message: ''};

function templateName(user) {
// Check if user is anonymous and if a specific template must be used
var isAnonymous = $document[0].getElementById('UIxAnonymousUserRightsEditor') && user.$isAnonymous();
return 'UIx' + (isAnonymous? 'Anonymous' : '') + 'UserRightsEditor';
}

function userFilter($query) {
return User.$filter($query, folder.$acl.users);
}
Expand Down

0 comments on commit de91b57

Please sign in to comment.