Esempio n. 1
0
        public void SubmitForm(RoleEntity roleEntity, string[] permissionIds, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                roleEntity.F_Id = keyValue;
            }
            else
            {
                roleEntity.F_Id = Common.GuId();
            }
            var moduledata = moduleApp.GetList();
            var buttondata = moduleButtonApp.GetList();
            List <RoleAuthorizeEntity> roleAuthorizeEntitys = new List <RoleAuthorizeEntity>();

            foreach (var itemId in permissionIds)
            {
                RoleAuthorizeEntity roleAuthorizeEntity = new RoleAuthorizeEntity();
                roleAuthorizeEntity.F_Id         = Common.GuId();
                roleAuthorizeEntity.F_ObjectType = 1;
                roleAuthorizeEntity.F_ObjectId   = roleEntity.F_Id;
                roleAuthorizeEntity.F_ItemId     = itemId;
                if (moduledata.Find(t => t.F_Id == itemId) != null)
                {
                    roleAuthorizeEntity.F_ItemType = 1;
                }
                if (buttondata.Find(t => t.F_Id == itemId) != null)
                {
                    roleAuthorizeEntity.F_ItemType = 2;
                }
                roleAuthorizeEntitys.Add(roleAuthorizeEntity);
            }
            service.SubmitForm(roleEntity, roleAuthorizeEntitys, keyValue);
        }
Esempio n. 2
0
        public List <ModuleButtonEntity> GetButtonList(string roleId)
        {
            var data = new List <ModuleButtonEntity>();

            if (OperatorProvider.Provider.GetCurrent().IsSystem)
            {
                data = _moduleButtonApp.GetList();
            }
            else
            {
                var buttondata    = _moduleButtonApp.GetList();
                var authorizedata = _service.IQueryable(t => t.F_ObjectId == roleId && t.F_ItemType == 2).ToList();
                data.AddRange(authorizedata.Select(item => buttondata.Find(t => t.F_Id == item.F_ItemId)).Where(moduleButtonEntity => moduleButtonEntity != null));
            }
            return(data.OrderBy(t => t.F_SortCode).ToList());
        }
        //获取角色按钮权限列表

        public List <ModuleButtonEntity> GetButtonList(string roleId)
        {
            var data = new List <ModuleButtonEntity>();

            if (OperatorProvider.Provider.GetCurrent().IsSystem)
            {
                data = moduleButtonApp.GetList();
            }
            else
            {
                var buttondata    = moduleButtonApp.GetList();
                var authorizedata = service.IQueryable(t => t.F_ObjectId == roleId && t.F_ItemType == 2).ToList();
                foreach (var item in authorizedata)
                {
                    ModuleButtonEntity moduleButtonEntity = buttondata.Find(t => t.F_Id == item.F_ItemId);
                    if (moduleButtonEntity != null)
                    {
                        data.Add(moduleButtonEntity);
                    }
                }
            }
            return(data.OrderBy(t => t.F_SortCode).ToList());
        }
Esempio n. 4
0
        public void SubmitForm(RoleEntity roleEntity, string[] permissionIds, string keyValue)
        {
            if (!string.IsNullOrEmpty(keyValue))
            {
                roleEntity.F_Id = keyValue;
            }
            else
            {
                roleEntity.F_Id = Common.GuId();
            }
            var moduledata = moduleApp.GetList();
            var buttondata = moduleButtonApp.GetList();
            List <RoleAuthorizeEntity> roleAuthorizeEntitys = new List <RoleAuthorizeEntity>();

            foreach (var itemId in permissionIds)
            {
                RoleAuthorizeEntity roleAuthorizeEntity = new RoleAuthorizeEntity();
                roleAuthorizeEntity.F_Id         = Common.GuId();
                roleAuthorizeEntity.F_ObjectType = 1;
                roleAuthorizeEntity.F_ObjectId   = roleEntity.F_Id;
                roleAuthorizeEntity.F_ItemId     = itemId;
                if (moduledata.Find(t => t.F_Id == itemId) != null)
                {
                    roleAuthorizeEntity.F_ItemType = 1;
                }
                if (buttondata.Find(t => t.F_Id == itemId) != null)
                {
                    roleAuthorizeEntity.F_ItemType = 2;
                }
                roleAuthorizeEntitys.Add(roleAuthorizeEntity);
            }
            service.SubmitForm(roleEntity, roleAuthorizeEntitys, keyValue);

            try
            {
                //添加日志
                LogMess.addLog(DbLogType.Update.ToString(), "修改成功", "修改角色信息【" + roleEntity.F_FullName + "】成功!");
            }
            catch { }
        }