public CreatePermission ( string type, bool allowed ) : void | ||
type | string | |
allowed | bool | |
Résultat | void |
public ActionResult Save(string id, string descriptionResourceName, string name, string remark, string resourceId, int operators) { ResourceDescription resourceDescription = OrnamentContext.ResourceManager.Configuration() .Get(descriptionResourceName); Permission permission; if (!string.IsNullOrEmpty(id)) { permission = _memberShipFactory.CreatePermissionDao().Get(id); } else { permission = Permission.CreatePermission(resourceDescription.ValueType); } IResourceDao dao = _memberShipFactory.CreateResourceDao(); permission.Name = name; permission.Remark = remark; permission.Resource = dao.GetResourceByStringId(resourceDescription.ValueType, resourceId); permission.Operator = operators; _memberShipFactory.CreatePermissionDao().SaveOrUpdate(permission); return(RedirectToAction("Index")); }
public IEnumerable <Permission> ProvidePermissions() { yield return(Permission.CreatePermission(PermissionNames.Roles_View, L(PermissionNames.Roles_View))); yield return(Permission.CreatePermission(PermissionNames.Roles_Create, L(PermissionNames.Roles_Create))); yield return(Permission.CreatePermission(PermissionNames.Roles_Edit, L(PermissionNames.Roles_Edit))); yield return(Permission.CreatePermission(PermissionNames.Roles_Delete, L(PermissionNames.Roles_Delete))); yield return(Permission.CreatePermission(PermissionNames.Users_View, L(PermissionNames.Users_View))); yield return(Permission.CreatePermission(PermissionNames.Users_Create, L(PermissionNames.Users_Create))); yield return(Permission.CreatePermission(PermissionNames.Users_Edit, L(PermissionNames.Users_Edit))); yield return(Permission.CreatePermission(PermissionNames.Users_Delete, L(PermissionNames.Users_Delete))); }
private void AddAdminToCompany(Admin new_admin, string company_position, string role) { Permission new_permission = Permission.CreatePermission(); try { Role admin_role = Role.GetRole(role); new_permission.admin_id = new_admin.admin_id; new_permission.role_name = admin_role; new_permission.company_id = current_company.company_id; new_permission.company_position = company_position; new_permission.authoriser_id = loggedInAdmin.admin_id; new_permission.creation_datetime = DateTime.Now; new_permission.Save(); AdminListErrorLabel.Text = "New administrator has been successfully added. An email has been sent informing them."; } catch (Exception ex) { AdminListErrorLabel.Text = ErrorHelper.generic; } }
public static IReadOnlyList <Permission> List() { return(new List <Permission> { Permission.CreatePermission(PermissionNames.Blogs_View, L(PermissionNames.Blogs_View)), Permission.CreatePermission(PermissionNames.Blogs_Create, L(PermissionNames.Blogs_Create)), Permission.CreatePermission(PermissionNames.Blogs_Edit, L(PermissionNames.Blogs_Edit)), Permission.CreatePermission(PermissionNames.Blogs_Delete, L(PermissionNames.Blogs_Delete)), Permission.CreatePermission(PermissionNames.Roles_View, L(PermissionNames.Roles_View)), Permission.CreatePermission(PermissionNames.Roles_Create, L(PermissionNames.Roles_Create)), Permission.CreatePermission(PermissionNames.Roles_Edit, L(PermissionNames.Roles_Edit)), Permission.CreatePermission(PermissionNames.Roles_Delete, L(PermissionNames.Roles_Delete)), Permission.CreatePermission(PermissionNames.Users_View, L(PermissionNames.Users_View)), Permission.CreatePermission(PermissionNames.Users_Create, L(PermissionNames.Users_Create)), Permission.CreatePermission(PermissionNames.Users_Edit, L(PermissionNames.Users_Edit)), Permission.CreatePermission(PermissionNames.Users_Delete, L(PermissionNames.Users_Delete)), Permission.CreatePermission(PermissionNames.Tasks_View, L(PermissionNames.Tasks_View)), Permission.CreatePermission(PermissionNames.Tasks_Create, L(PermissionNames.Tasks_Create)), Permission.CreatePermission(PermissionNames.Tasks_Edit, L(PermissionNames.Tasks_Edit)), Permission.CreatePermission(PermissionNames.Tasks_Delete, L(PermissionNames.Tasks_Delete)), Permission.CreatePermission(PermissionNames.Products_View, L(PermissionNames.Products_View)), Permission.CreatePermission(PermissionNames.Products_Create, L(PermissionNames.Products_Create)), Permission.CreatePermission(PermissionNames.Products_Edit, L(PermissionNames.Products_Edit)), Permission.CreatePermission(PermissionNames.Products_Delete, L(PermissionNames.Products_Delete)), Permission.CreatePermission(PermissionNames.Invoices_View, L(PermissionNames.Invoices_View)), Permission.CreatePermission(PermissionNames.Invoices_Create, L(PermissionNames.Invoices_Create)), Permission.CreatePermission(PermissionNames.Invoices_Edit, L(PermissionNames.Invoices_Edit)), Permission.CreatePermission(PermissionNames.Invoices_Delete, L(PermissionNames.Invoices_Delete)) }); }
public IEnumerable <Permission> ProvidePermissions() { yield return(Permission.CreatePermission(PermissionNames.Administration, L(PermissionNames.Administration)) .CreateChildPermission(PermissionNames.Administration_Blogs_View, L(PermissionNames.Administration_Blogs_View)) .CreateChildPermission(PermissionNames.Administration_Blogs_Create, L(PermissionNames.Administration_Blogs_Create)) .CreateChildPermission(PermissionNames.Administration_Blogs_Edit, L(PermissionNames.Administration_Blogs_Edit)) .CreateChildPermission(PermissionNames.Administration_Blogs_Delete, L(PermissionNames.Administration_Blogs_Delete))); }
private async Task <Permission> MaterializepPermissionFromDto(PermissionDto permission) { var _typePermission = await _solicitudDbContext.FindByKey <TypePermission>(permission.TypePermissionId); _typePermission.ChangeCurrentIdentity(permission.TypePermissionId); var _current = Permission.CreatePermission(permission.Name, permission.LastName, _typePermission); _current.ChangeCurrentIdentity(permission.Id); return(_current); }
private async Task <Permission> CreatePermission(PermissionDto permission) { var _typepermission = await _solicitudDbContext.FindByKey <TypePermission>(permission.TypePermissionId); _typepermission.ChangeCurrentIdentity(permission.TypePermissionId); var _permission = Permission.CreatePermission(permission.Name, permission.LastName, permission.TypePermissionId); //set identity _permission.ChangeCurrentIdentity(permission.Id); return(_permission); }
/// <summary> /// 根据ResourceDescript的设置,生成用于选择Resource 的View /// </summary> /// <param name="id">res description's name</param> /// <param name="permissionId">permissionId</param> /// <returns></returns> public ActionResult ChoiceResourceView(string id, string permissionId) { ResourceDescription resourceDescription = OrnamentContext.ResourceManager.Configuration() .Get(id); Permission permission = !string.IsNullOrEmpty(permissionId) ? _memberShipFactory.CreatePermissionDao().Get(permissionId) : Permission.CreatePermission(resourceDescription.ValueType); var model = new PermissionResourceSelectModel { Description = resourceDescription, Permission = permission }; return(View(model.Description.Path, model)); }
public void Create() { if (input.Any()) { var domain = new List <Permission>(); var allFatherPermissions = input.GroupBy(x => x.ServerName).Select(x => x.Key).ToList(); if (!allFatherPermissions.Any()) { throw new DomainException("服务名无效!"); } repository.Delete(x => true);//直接删除所有 allFatherPermissions.ForEach(x => { var permission = new Permission(); permission.CreatePermission(Guid.Empty, x, ""); repository.Add(permission); var child = input.Where(y => y.ServerName == x).ToList(); if (!child.Any()) { throw new DomainException($"服务{x}下没有有效接口!"); } else { child.ForEach(y => { if (string.IsNullOrEmpty(y.Path)) { throw new DomainException($"服务{x}下没有有效接口地址!"); } var childpermission = new Permission(); childpermission.CreatePermission(permission.Id, y.PermissionName, y.Path); repository.Add(childpermission); }); } }); } else { throw new DomainException("请至少输入一个权限"); } }
public IEnumerable <Permission> ProvidePermissions() { yield return(Permission.CreatePermission(PermissionNames.Blogs_View, L(PermissionNames.Blogs_View))); yield return(Permission.CreatePermission(PermissionNames.Blogs_Create, L(PermissionNames.Blogs_Create))); yield return(Permission.CreatePermission(PermissionNames.Blogs_Edit, L(PermissionNames.Blogs_Edit))); yield return(Permission.CreatePermission(PermissionNames.Blogs_Delete, L(PermissionNames.Blogs_Delete))); yield return(Permission.CreatePermission(PermissionNames.Roles_View, L(PermissionNames.Roles_View))); yield return(Permission.CreatePermission(PermissionNames.Roles_Create, L(PermissionNames.Roles_Create))); yield return(Permission.CreatePermission(PermissionNames.Roles_Edit, L(PermissionNames.Roles_Edit))); yield return(Permission.CreatePermission(PermissionNames.Roles_Delete, L(PermissionNames.Roles_Delete))); yield return(Permission.CreatePermission(PermissionNames.Users_View, L(PermissionNames.Users_View))); yield return(Permission.CreatePermission(PermissionNames.Users_Create, L(PermissionNames.Users_Create))); yield return(Permission.CreatePermission(PermissionNames.Users_Edit, L(PermissionNames.Users_Edit))); yield return(Permission.CreatePermission(PermissionNames.Users_Delete, L(PermissionNames.Users_Delete))); yield return(Permission.CreatePermission(PermissionNames.Tasks_View, L(PermissionNames.Tasks_View))); yield return(Permission.CreatePermission(PermissionNames.Tasks_Create, L(PermissionNames.Tasks_Create))); yield return(Permission.CreatePermission(PermissionNames.Tasks_Edit, L(PermissionNames.Tasks_Edit))); yield return(Permission.CreatePermission(PermissionNames.Tasks_Delete, L(PermissionNames.Tasks_Delete))); yield return(Permission.CreatePermission(PermissionNames.Products_View, L(PermissionNames.Products_View))); yield return(Permission.CreatePermission(PermissionNames.Products_Create, L(PermissionNames.Products_Create))); yield return(Permission.CreatePermission(PermissionNames.Products_Edit, L(PermissionNames.Products_Edit))); yield return(Permission.CreatePermission(PermissionNames.Products_Delete, L(PermissionNames.Products_Delete))); yield return(Permission.CreatePermission(PermissionNames.Invoices_View, L(PermissionNames.Invoices_View))); yield return(Permission.CreatePermission(PermissionNames.Invoices_Create, L(PermissionNames.Invoices_Create))); yield return(Permission.CreatePermission(PermissionNames.Invoices_Edit, L(PermissionNames.Invoices_Edit))); yield return(Permission.CreatePermission(PermissionNames.Invoices_Delete, L(PermissionNames.Invoices_Delete))); yield return(Permission.CreatePermission(PermissionNames.Person_View, L(PermissionNames.Person_View))); yield return(Permission.CreatePermission(PermissionNames.Person_Create, L(PermissionNames.Person_Create))); yield return(Permission.CreatePermission(PermissionNames.Person_Edit, L(PermissionNames.Person_Edit))); yield return(Permission.CreatePermission(PermissionNames.Person_Delete, L(PermissionNames.Person_Delete))); }