public RemoveNodeOntologyCatalogCommand(IAcSession acSession, Guid nodeId, Guid ontologyId, Guid catalogId)
 {
     this.AcSession = acSession;
     this.NodeId = nodeId;
     this.OntologyId = ontologyId;
     this.CatalogId = catalogId;
 }
示例#2
0
 public SaveHelpCommand(IAcSession acSession, Guid functionId, string content, int? isEnabled)
 {
     this.AcSession = acSession;
     this.FunctionId = functionId;
     this.Content = content;
     this.IsEnabled = isEnabled;
 }
        public bool Permit(IAcSession user, FunctionState function, IManagedObject data)
        {
            if (function == null)
            {
                throw new ArgumentNullException("function");
            }
            // 如果非托管
            if (!function.IsManaged)
            {
                return true;
            }
            if (!user.Identity.IsAuthenticated)
            {
                return false;
            }
            if (user.IsDeveloper())
            {
                return true;
            }
            var functionIDs = user.AccountPrivilege.AuthorizedFunctionIDs;

            if (!functionIDs.Contains(function.Id))
            {
                return false;
            }
            if (data != null)
            {
                // TODO:验证实体级权限。anycmd 1.0版本暂不支持,后续版本支持
            }
            return true;
        }
示例#4
0
 protected ActionResult HandleSeparateGuidString(Action<IAcSession, Guid> action, IAcSession acSession, string id, params char[] separator)
 {
     if (action == null)
     {
         throw new ArgumentNullException("action");
     }
     if (id == null)
     {
         throw new ArgumentNullException("id");
     }
     string[] ids = id.Split(separator);
     var idArray = new Guid[ids.Length];
     for (int i = 0; i < ids.Length; i++)
     {
         Guid tmp;
         if (Guid.TryParse(ids[i], out tmp))
         {
             idArray[i] = tmp;
         }
         else
         {
             throw new ValidationException("意外的Guid格式" + ids[i]);
         }
     }
     foreach (var item in idArray)
     {
         action(acSession, item);
     }
     return this.JsonResult(new ResponseData { id = id, success = true });
 }
 public OntologyUpdatedEvent(IAcSession acSession, OntologyBase source, IOntologyUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
示例#6
0
 public CatalogRemovedEvent(IAcSession acSession, CatalogBase source)
     : base(acSession, source)
 {
     if (source == null)
     {
         throw new ArgumentException("source");
     }
     this.CatalogCode = source.Code;
 }
示例#7
0
 public ArchiveUpdatedEvent(IAcSession acSession, ArchiveBase source)
     : base(acSession, source)
 {
     this.DataSource = source.DataSource;
     this.FilePath = source.FilePath;
     this.NumberId = source.NumberId;
     this.UserId = source.UserId;
     this.Password = source.Password;
 }
 public UpdateDbViewColumnCommand(IAcSession acSession, IDbViewColumnUpdateInput input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     this.AcSession = acSession;
     this.Input = input;
 }
 public InfoDicItemUpdatedEvent(IAcSession acSession, InfoDicItemBase source, IInfoDicItemUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
示例#10
0
 public MenuUpdatedEvent(IAcSession acSession, MenuBase source, IMenuUpdateIo input)
     : base(acSession, source)
 {
     if (input == null)
     {
         throw new System.ArgumentNullException("input");
     }
     this.Input = input;
 }
示例#11
0
 public AppSystemAddedEvent(IAcSession acSession, AppSystemBase source, IAppSystemCreateIo input)
     : base(acSession, source)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     this.Input = input;
 }
示例#12
0
 public AssignPasswordCommand(IAcSession acSession, IPasswordAssignIo input)
 {
     if (input == null)
     {
         throw new ArgumentNullException("input");
     }
     this.AcSession = acSession;
     this.Input = input;
 }
示例#13
0
 public RoleUpdatedEvent(IAcSession acSession, RoleBase source, IRoleUpdateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new ArgumentNullException("output");
     }
     this.Output = output;
 }
 public NodeElementCareAddedEvent(IAcSession acSession, NodeElementCareBase source, INodeElementCareCreateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
 public UiViewButtonUpdatedEvent(IAcSession acSession, UiViewButtonBase source, IUiViewButtonUpdateIo input)
     : base(acSession, source)
 {
     if (input == null)
     {
         throw new System.ArgumentNullException("input");
     }
     this.Input = input;
 }
 public NodeOntologyCatalogAddedEvent(IAcSession acSession, NodeOntologyCatalogBase source, INodeOntologyCatalogCreateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
示例#17
0
 public PrivilegeAddedEvent(IAcSession acSession, PrivilegeBase source, IPrivilegeCreateIo output)
     : base(acSession, source)
 {
     if (output == null)
     {
         throw new System.ArgumentNullException("output");
     }
     this.Output = output;
 }
示例#18
0
 /// <summary>
 /// 
 /// </summary>
 public ActionUpdatedEvent(IAcSession acSession, ActionBase source)
     : base(acSession, source)
 {
     this.Verb = source.Verb;
     this.Name = source.Name;
     this.IsAllowed = source.IsAllowed;
     this.IsAudit = source.IsAudit;
     this.IsPersist = source.IsPersist;
     this.SortCode = source.SortCode;
 }
示例#19
0
 public void AddActiveRole(IAcSession subject, IAcSession targetSession, Guid roleId)
 {
     RoleState role;
     if (!_acDomain.RoleSet.TryGetRole(roleId, out role))
     {
         throw new ValidationException("给定标识的角色不存在" + roleId);
     }
     IAcSession session = targetSession;
     if (session == null)
     {
         throw new ValidationException("给定标识的会话不存在");
     }
     session.AccountPrivilege.AddActiveRole(role);
 }
示例#20
0
 public void AddDescendant(IAcSession subject, Guid parentRoleId, IRoleCreateIo childRoleCreateInput)
 {
     _acDomain.Handle(new AddRoleCommand(subject, childRoleCreateInput));
     Debug.Assert(childRoleCreateInput.Id != null, "childRoleCreateInput.Id != null");
     _acDomain.Handle(new AddPrivilegeCommand(subject, new PrivilegeCreateIo
     {
         Id = Guid.NewGuid(),
         SubjectType = UserAcSubjectType.Role.ToName(),
         SubjectInstanceId = childRoleCreateInput.Id.Value,
         ObjectType = AcElementType.Role.ToName(),
         ObjectInstanceId = parentRoleId,
         AcContent = null,
         AcContentType = null
     }));
 }
示例#21
0
 public AddProcessCommand(IAcSession acSession, IProcessCreateIo input)
     : base(acSession, input)
 {
 }
示例#22
0
 internal DeveloperRemovedEvent(IAcSession acSession, DeveloperId source, bool isPrivate)
     : this(acSession, source)
 {
     this.IsPrivate = isPrivate;
 }
示例#23
0
 public DeveloperRemovedEvent(IAcSession acSession, DeveloperId source) : base(acSession, source)
 {
 }
示例#24
0
 public RoleRolePrivilegeRemovedEvent(IAcSession acSession, PrivilegeBase source)
     : base(acSession, source)
 {
 }
示例#25
0
 public UpdateDsdSetCommand(IAcSession acSession, IDsdSetUpdateIo input)
     : base(acSession, input)
 {
 }
示例#26
0
 public override IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return(new AddCatalogCommand(acSession, this));
 }
示例#27
0
文件: MenuSet.cs 项目: zszqwe/anycmd
            private void Handle(IAcSession acSession, IMenuCreateIo input, bool isCommand)
            {
                var acDomain       = _set._acDomain;
                var menuById       = _set._menuById;
                var menuRepository = acDomain.RetrieveRequiredService <IRepository <Menu> >();

                if (!input.Id.HasValue)
                {
                    throw new ValidationException("标识是必须的");
                }
                MenuState menu;

                if (acDomain.MenuSet.TryGetMenu(input.Id.Value, out menu))
                {
                    throw new ValidationException("给定标识的实体已经存在" + input.Id);
                }
                if (input.ParentId.HasValue)
                {
                    MenuState parentMenu;
                    if (!acDomain.MenuSet.TryGetMenu(input.ParentId.Value, out parentMenu))
                    {
                        throw new NotExistException("标识为" + input.ParentId.Value + "的父菜单不存在");
                    }
                    if (input.AppSystemId != parentMenu.AppSystemId)
                    {
                        throw new ValidationException("非法的数据,子菜单的应用系统必须和父菜单一致");
                    }
                }

                var entity = Menu.Create(input);

                lock (Locker)
                {
                    if (acDomain.MenuSet.TryGetMenu(input.Id.Value, out menu))
                    {
                        throw new ValidationException("给定标识的实体已经存在" + input.Id);
                    }
                    if (input.ParentId.HasValue)
                    {
                        MenuState parentMenu;
                        if (!acDomain.MenuSet.TryGetMenu(input.ParentId.Value, out parentMenu))
                        {
                            throw new NotExistException("标识为" + input.ParentId.Value + "的父菜单不存在");
                        }
                    }
                    var menuState = MenuState.Create(acDomain, entity);
                    if (!menuById.ContainsKey(entity.Id))
                    {
                        menuById.Add(entity.Id, menuState);
                    }
                    if (isCommand)
                    {
                        try
                        {
                            menuRepository.Add(entity);
                            menuRepository.Context.Commit();
                        }
                        catch
                        {
                            if (menuById.ContainsKey(entity.Id))
                            {
                                menuById.Remove(entity.Id);
                            }
                            menuRepository.Context.Rollback();
                            throw;
                        }
                    }
                }
                if (isCommand)
                {
                    acDomain.MessageDispatcher.DispatchMessage(new MenuAddedEvent(acSession, entity, input, isPrivate: true));
                }
            }
示例#28
0
 public override IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return new AddRoleCommand(acSession, this);
 }
示例#29
0
 internal PrivilegeRemovedEvent(IAcSession acSession, PrivilegeBase source, bool isPrivate)
     : this(acSession, source)
 {
     this.IsPrivate = isPrivate;
 }
示例#30
0
 public BatchRemovedEvent(IAcSession acSession, IBatch source)
     : base(acSession, source)
 {
 }
示例#31
0
 public AddPrivilegeCommand(IAcSession acSession, IPrivilegeCreateIo input)
     : base(acSession, input)
 {
 }
示例#32
0
 public RemovePrivilegeCommand(IAcSession acSession, Guid privilegeBigramId)
     : base(acSession, privilegeBigramId)
 {
 }
示例#33
0
 public UpdatePrivilegeCommand(IAcSession acSession, IPrivilegeUpdateIo input)
     : base(acSession, input)
 {
 }
示例#34
0
 internal UiViewUpdatedEvent(IAcSession acSession, UiViewBase source, IUiViewUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
示例#35
0
 public AddDsdRoleCommand(IAcSession acSession, IDsdRoleCreateIo input)
     : base(acSession, input)
 {
 }
示例#36
0
 public AddActionCommand(IAcSession acSession, IActionCreateIo input)
     : base(acSession, input)
 {
 }
示例#37
0
 public override IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return(new AddAppSystemCommand(acSession, this));
 }
示例#38
0
 public AppSystemRemovedEvent(IAcSession acSession, AppSystemBase source)
     : base(acSession, source)
 {
 }
示例#39
0
 public ButtonRemovedEvent(IAcSession acSession, ButtonBase source)
     : base(acSession, source)
 {
 }
示例#40
0
 public IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return(new UpdateAccountCommand(acSession, this));
 }
 public IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return(new UpdateUiViewButtonCommand(acSession, this));
 }
示例#42
0
 internal PrivilegeUpdatedEvent(IAcSession acSession, PrivilegeBase source, IPrivilegeUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
示例#43
0
 public RemoveGroupCommand(IAcSession acSession, Guid groupId)
     : base(acSession, groupId)
 {
 }
示例#44
0
 internal InfoDicItemAddedEvent(IAcSession acSession, InfoDicItemBase source, IInfoDicItemCreateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
示例#45
0
 public AccountAddedEvent(IAcSession acSession, AccountBase source) : base(acSession, source) { }
示例#46
0
 public RemoveArchiveCommand(IAcSession acSession, Guid archiveId)
     : base(acSession, archiveId)
 {
 }
示例#47
0
 public ElementRemovedEvent(IAcSession acSession, ElementBase source) : base(acSession, source)
 {
 }
示例#48
0
 public RemoveBatchCommand(IAcSession acSession, Guid batchId)
     : base(acSession, batchId)
 {
 }
 public CatalogActionAddedEvent(IAcSession acSession, CatalogAction source)
     : base(acSession, source)
 {
 }
示例#50
0
 public UpdateStateCodeCommand(IAcSession acSession, IStateCodeUpdateInput input)
     : base(acSession, input)
 {
 }
示例#51
0
 public IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return new UpdateInfoRuleCommand(acSession, this);
 }
示例#52
0
 internal NodeUpdatedEvent(IAcSession acSession, NodeBase source, INodeUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
 public NodeActionRemovedEvent(IAcSession acSession, NodeAction source)
     : base(acSession, source)
 {
 }
示例#54
0
 public AddBatchCommand(IAcSession acSession, IBatchCreateIo input)
     : base(acSession, input)
 {
 }
 internal InfoDicItemUpdatedEvent(IAcSession acSession, InfoDicItemBase source, IInfoDicItemUpdateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
示例#56
0
 public UpdateInfoDicItemCommand(IAcSession acSession, IInfoDicItemUpdateIo input)
     : base(acSession, input)
 {
 }
示例#57
0
 internal AppSystemRemovedEvent(IAcSession acSession, AppSystemBase source, bool isPrivate)
     : this(acSession, source)
 {
     this.IsPrivate = isPrivate;
 }
示例#58
0
 internal OntologyCatalogAddedEvent(IAcSession acSession, OntologyCatalogBase source, IOntologyCatalogCreateIo input, bool isPrivate)
     : this(acSession, source, input)
 {
     this.IsPrivate = isPrivate;
 }
示例#59
0
 internal ButtonRemovedEvent(IAcSession acSession, ButtonBase source, bool isPrivate)
     : this(acSession, source)
 {
     this.IsPrivate = isPrivate;
 }
 public IAnycmdCommand ToCommand(IAcSession acSession)
 {
     return(new UpdateDbViewColumnCommand(acSession, this));
 }