Exemple #1
0
        /// <summary>
        /// Retrieves an entitycollection with all the forum-actionright-role combinations currently defined for the role specified for the given forum
        /// </summary>
        /// <param name="roleID">The role which forum action rights should be retrieved.</param>
        /// <param name="forumID">The forum ID.</param>
        /// <returns>filled entity collection
        /// </returns>
        public static ForumRoleForumActionRightCollection GetForumActionRightRolesFoForumRole(int roleID, int forumID)
        {
            ForumRoleForumActionRightCollection toReturn = new ForumRoleForumActionRightCollection();

            toReturn.GetMulti((ForumRoleForumActionRightFields.RoleID == roleID).And(ForumRoleForumActionRightFields.ForumID == forumID));
            return(toReturn);
        }
Exemple #2
0
        /// <summary>
        /// Gets the Forum action rights for user.
        /// </summary>
        /// <param name="userID">The user ID.</param>
        /// <returns>fetched collection</returns>
        public static ForumRoleForumActionRightCollection GetForumsActionRightsForUser(int userID)
        {
            ForumRoleForumActionRightCollection forumRoleActionRights = new ForumRoleForumActionRightCollection();

            // the subquery in the filter requires joins as the filter's subquery has to filter on fields in related entities:
            // WHERE RoleID IN (SELECT RoleID FROM Role INNER JOIN RoleUser ... WHERE RoleUser.UserID=userID)
            RelationCollection relations = new RelationCollection();

            relations.Add(RoleEntity.Relations.RoleUserEntityUsingRoleID);

            PredicateExpression filter = new PredicateExpression();

            filter.Add(new FieldCompareSetPredicate(ForumRoleForumActionRightFields.RoleID,
                                                    RoleFields.RoleID, SetOperator.In, (RoleUserFields.UserID == userID), relations));

            forumRoleActionRights.GetMulti(filter);
            return(forumRoleActionRights);
        }