Example #1
0
        public bool Import(Guid solutionId, IList <Privilege> privileges)
        {
            if (privileges.NotEmpty())
            {
                foreach (var item in privileges)
                {
                    var entity = _privilegeService.FindById(item.PrivilegeId);
                    if (entity != null)
                    {
                        entity.BigIcon           = item.BigIcon;
                        entity.ClassName         = item.ClassName;
                        entity.DisplayName       = item.DisplayName;
                        entity.DisplayOrder      = item.DisplayOrder;
                        entity.IsVisibled        = item.IsVisibled;
                        entity.Level             = item.Level;
                        entity.MethodName        = item.MethodName;
                        entity.OpenTarget        = item.OpenTarget;
                        entity.ParentPrivilegeId = item.ParentPrivilegeId;
                        entity.SmallIcon         = item.SmallIcon;
                        entity.SystemName        = item.SystemName;
                        entity.Url = item.Url;
                        entity.AuthorizationEnabled = item.AuthorizationEnabled;
                        entity.Description          = item.Description;
                        _privilegeService.Update(entity);
                    }
                    else
                    {
                        item.OrganizationId = _appContext.OrganizationId;
                        _privilegeService.Create(item);
                    }
                }
            }

            return(true);
        }
Example #2
0
        public IActionResult EditPrivilege(Guid?id)
        {
            EditPrivilegeModel model = new EditPrivilegeModel();

            if (id.HasValue && !id.Equals(Guid.Empty))
            {
                Privilege entity = _privilegeService.FindById(id.Value);
                if (IsRequestJson)
                {
                    return(JOk(entity));
                }
            }

            return(JOk(null));
        }