public static void GrandObjectAccessRecursively(this SecuritySystemRoleBase defaultRole) { Type roleType = defaultRole.GetType(); foreach (Type type in SecurityStrategy.GetSecuredTypes().Where(type => roleType == type || type.IsAssignableFrom(roleType))) { defaultRole.AddObjectAccessPermission(type, "[Name]='" + defaultRole.Name + "'", SecurityOperations.ReadOnlyAccess); } }
public static SecuritySystemTypePermissionObject CreateTypePermission(this SecuritySystemRoleBase systemRole, Type targetType) { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(systemRole); var permissionObject = objectSpace.CreateObject <SecuritySystemTypePermissionObject>(); permissionObject.TargetType = targetType; systemRole.TypePermissions.Add(permissionObject); return(permissionObject); }
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 void CreatePermissionBehaviour(this SecuritySystemRoleBase systemRole, Enum behaviourEnum, Action <SecuritySystemRoleBase, ITypeInfo> action) { var typeInfos = XafTypesInfo.Instance.PersistentTypes.Where(info => { var permissionBehaviorAttribute = info.FindAttribute <PermissionBehaviorAttribute>(); return(permissionBehaviorAttribute != null && permissionBehaviorAttribute.Name.Equals(Enum.GetName(behaviourEnum.GetType(), behaviourEnum))); }); foreach (var typeInfo in typeInfos) { action.Invoke(systemRole, typeInfo); } }
public static SecuritySystemTypePermissionObject AddNewTypePermission(this SecuritySystemRoleBase role, Type targetType, Action <SecuritySystemTypePermissionObject> action, bool defaultAllowValues = true) { var permission = AddNewTypePermission(role, 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); }
public static SecuritySystemTypePermissionObject CreateTypePermission <TObject>(this SecuritySystemRoleBase systemRole) { return(CreateTypePermission(systemRole, typeof(TObject))); }
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 ISecurityUserWithRoles GetUser(this SecuritySystemRoleBase systemRole, string userName, string passWord = "") { var objectSpace = XPObjectSpace.FindObjectSpaceByObject(systemRole); return(GetUser(objectSpace, userName, passWord, systemRole)); }
public static void CreateFullPermissionAttributes(this SecuritySystemRoleBase systemRole, Action <SecuritySystemTypePermissionObject> action = null, bool defaultAllowValues = true) { AddNewFullPermissionAttributes(systemRole, action, defaultAllowValues); }
public static SecuritySystemTypePermissionObject AddNewTypePermission <TObject>(this SecuritySystemRoleBase role) { return(AddNewTypePermission(role, typeof(TObject))); }
public static SecuritySystemTypePermissionObject AddNewTypePermission <TObject>(this SecuritySystemRoleBase role, Action <SecuritySystemTypePermissionObject> action, bool defaultAllowValues = true) { return(AddNewTypePermission(role, typeof(TObject), action, defaultAllowValues)); }
public static SecuritySystemTypePermissionObject CreateTypePermission(this SecuritySystemRoleBase systemRole, Type targetType, Action <SecuritySystemTypePermissionObject> action, bool defaultAllowValues = true) { return(AddNewTypePermission(systemRole, targetType, action, defaultAllowValues)); }
public static SecuritySystemTypePermissionObject CreateTypePermission(this SecuritySystemRoleBase role, Type targetType) { return(AddNewTypePermission(role, targetType)); }