public static void CreateFullPermissionAttributes(this SecuritySystemRoleBase systemRole, Action <SecuritySystemTypePermissionObject> action = null, bool defaultAllowValues = true) { var persistentTypes = XafTypesInfo.Instance.PersistentTypes.Where(info => info.FindAttribute <FullPermissionAttribute>() != null); foreach (var typeInfo in persistentTypes) { systemRole.CreateTypePermission(typeInfo.Type, action, defaultAllowValues); } }
public static SecuritySystemTypePermissionObject CreateTypePermission <TObject>(this SecuritySystemRoleBase systemRole, Action <SecuritySystemTypePermissionObject> action, bool defaultAllowValues = true) { var targetType = typeof(TObject); var permission = systemRole.CreateTypePermission <TObject>(); permission.TargetType = targetType; permission.AllowDelete = defaultAllowValues; permission.AllowNavigate = defaultAllowValues; permission.AllowRead = defaultAllowValues; permission.AllowWrite = defaultAllowValues; permission.AllowCreate = defaultAllowValues; action.Invoke(permission); return(permission); }
public static SecuritySystemTypePermissionObject CreateTypePermission(this SecuritySystemRoleBase systemRole, Type targetType, Action <SecuritySystemTypePermissionObject> action, bool defaultAllowValues = true) { var permission = systemRole.CreateTypePermission(targetType); permission.TargetType = targetType; permission.AllowDelete = defaultAllowValues; permission.AllowNavigate = defaultAllowValues; permission.AllowRead = defaultAllowValues; permission.AllowWrite = defaultAllowValues; permission.AllowCreate = defaultAllowValues; if (action != null) { action.Invoke(permission); } return(permission); }