/// <summary> /// Retrieves all action rights which are system action rights and which aren't applyable to a forum /// </summary> /// <returns>entitycollection with all the system action rights</returns> public static ActionRightCollection GetAllSystemActionRights() { ActionRightCollection toReturn = new ActionRightCollection(); toReturn.GetMulti((ActionRightFields.AppliesToSystem == true), 0, new SortExpression(ActionRightFields.ActionRightID | SortOperator.Ascending)); return(toReturn); }
/// <summary> /// Retrieves all ActionRight entities which are applyable to a forum. /// </summary> /// <returns>entitycollection with all the action rights requested</returns> public static ActionRightCollection GetAllActionRightsApplybleToAForum() { ActionRightCollection toReturn = new ActionRightCollection(); toReturn.GetMulti((ActionRightFields.AppliesToForum == true), 0, new SortExpression(ActionRightFields.ActionRightID.Ascending())); return(toReturn); }
/// <summary> /// Gets the system action rights for user. /// </summary> /// <param name="userID">The user ID.</param> /// <param name="actionRights">The action rights to be returned.</param> /// <returns>filled collection</returns> public static ActionRightCollection GetSystemActionRightsForUser(int userID) { ActionRightCollection actionRights = new ActionRightCollection(); // the subquery in the filter requires joins as the filter's subquery has to filter on fields in related entities: // WHERE ActionRightID IN (SELECT ActionRightID FROM RoleSystemActionRight INNER JOIN Role ... INNER JOIN RoleUser ... WHERE RoleUser.UserID=userID) RelationCollection relations = new RelationCollection(); relations.Add(RoleSystemActionRightEntity.Relations.RoleEntityUsingRoleID); relations.Add(RoleEntity.Relations.RoleUserEntityUsingRoleID); PredicateExpression filter = new PredicateExpression(); // retrieve system action rights only. filter.Add(ActionRightFields.AppliesToSystem == true); filter.Add(new FieldCompareSetPredicate( ActionRightFields.ActionRightID, RoleSystemActionRightFields.ActionRightID, SetOperator.In, (RoleUserFields.UserID == userID), relations)); actionRights.GetMulti(filter); return(actionRights); }