Ejemplo n.º 1
0
 public void AllRightsAreFalseOnCreation()
 {
     for (int i = 0; i < (int)Permission.Rights.LastRight; i++)
     {
         Permission.Rights right = (Permission.Rights)i;
         Assert.AreEqual(false, testPermissionObject.HasPermission(right));
     }
 }
Ejemplo n.º 2
0
 public void SetAllRightsFalse()
 {
     testPermissionObject.SetAllRights(false);
     for (int i = 0; i < (int)Permission.Rights.LastRight; i++)
     {
         Permission.Rights right = (Permission.Rights)i;
         Assert.AreEqual(false, testPermissionObject.HasPermission(right));
     }
 }
Ejemplo n.º 3
0
		/// <summary>
		/// Determines whether the specified user has access 
		/// to any forum in the category.
		/// </summary>
		/// <param name="user">The user.</param>
		/// <param name="right">The right.</param>
		/// <returns>
		/// 	<c>true</c> if the specified user has access; otherwise, <c>false</c>.
		/// </returns>
		public bool HasAccess(ForumUser user, Permission.Rights right)
		{
			foreach (Forum forum in Forums)
			{
				if (forum.HasAccess(user, right))
				{
					return true;
				}
			}

			return false;
		}
Ejemplo n.º 4
0
        /// <summary>
        /// Determines whether the specified user has access.
        /// </summary>
        /// <param name="user">The user.</param>
        /// <param name="rights">The rights.</param>
        /// <returns>
        ///     <c>true</c> if the specified user has access; otherwise, <c>false</c>.
        /// </returns>
        public bool HasAccess(ForumUser user, Permission.Rights rights)
        {
            foreach (Group userGroup in user.Groups)
            {
                Permission perm = Permissions[userGroup.Id] as Permission;
                if (perm != null)
                {
                    if (perm.HasPermission(rights))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }