Example #1
0
 private PermissionUpdateModel(
     IntranetMemberGroup group,
     PermissionSettingValues settingValues,
     PermissionSettingIdentity settingIdentity)
 {
     Group           = group;
     SettingIdentity = settingIdentity;
     SettingValues   = settingValues;
 }
        private static PermissionUpdateModel CreatePermission(
            IntranetMemberGroup group,
            Resource resource,
            PermissionActionEnum action,
            bool allowed = true, bool enabled = true)
        {
            var identity = new PermissionSettingIdentity(action, resource);
            var settings = new PermissionSettingValues(allowed, enabled);

            return(new PermissionUpdateModel(group, settings, identity));
        }
        public virtual GroupPermissionsViewModel Save(PermissionUpdateViewModel update)
        {
            var settingIdentity = PermissionSettingIdentity.Of(
                _actionTypeProvider[update.ActionId],
                _resourceTypeProvider[update.ResourceTypeId]);
            var settingValue = PermissionSettingValues.Of(update.Allowed, update.Enabled);
            var targetGroup  = _intranetMemberGroupProvider[update.IntranetMemberGroupId];

            var mappedUpdate = PermissionUpdateModel.Of(targetGroup, settingValue, settingIdentity);

            _permissionsService.Save(mappedUpdate);

            return(Get(update.IntranetMemberGroupId));
        }
Example #4
0
        public async Task <GroupPermissionsViewModel> Save(PermissionUpdateViewModel update)
        {
            var settingIdentity = new PermissionSettingIdentity(
                _actionTypeProvider[update.ActionId],
                _resourceTypeProvider[update.ResourceTypeId]);
            var settingValue = new PermissionSettingValues(update.Allowed, update.Enabled);
            var targetGroup  = _intranetMemberGroupProvider[update.IntranetMemberGroupId];
            //var targetGroup = _intranetMemberGroupService.GetAll().First(x => x.Id == update.IntranetMemberGroupId);

            var mappedUpdate = new PermissionUpdateModel(targetGroup, settingValue, settingIdentity);
            await _permissionsService.SaveAsync(mappedUpdate);

            return(await Get(update.IntranetMemberGroupId));
        }
 public virtual PermissionSettingValues GetDefault(PermissionSettingIdentity settingIdentity) =>
 SettingsOverrides
 .ItemOrNone(settingIdentity)
 .IfNone(() => PermissionSettingValues.Of(GlobalIsAllowedDefault, GlobalIsEnabledDefault));
Example #6
0
 public static PermissionUpdateModel Of(
     IntranetMemberGroup group,
     PermissionSettingValues settingValues,
     PermissionSettingIdentity identity) =>
 new PermissionUpdateModel(group, settingValues, identity);