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;
 }
예제 #3
0
        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 });
 }
예제 #5
0
 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;
 }
예제 #9
0
 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;
 }
예제 #15
0
 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)
 {
 }
예제 #49
0
 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;
 }
예제 #53
0
 public NodeActionRemovedEvent(IAcSession acSession, NodeAction source)
     : base(acSession, source)
 {
 }
예제 #54
0
 public AddBatchCommand(IAcSession acSession, IBatchCreateIo input)
     : base(acSession, input)
 {
 }
예제 #55
0
 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));
 }