Beispiel #1
0
 /// <summary>
 /// Indicates whether the property has a list
 /// of roles denied write access.
 /// </summary>
 /// <param name="propertyName">Name of the property.</param>
 public bool HasWriteDeniedRoles(string propertyName)
 {
     if (InstanceRules.GetRolesForProperty(propertyName).WriteDenied.Count > 0)
     {
         return(true);
     }
     return(TypeRules.GetRolesForProperty(propertyName).WriteDenied.Count > 0);
 }
Beispiel #2
0
 /// <summary>
 /// Indicates whether the property has a list
 /// of roles granted read access.
 /// </summary>
 /// <param name="propertyName">Name of the property.</param>
 public bool HasReadAllowedRoles(string propertyName)
 {
     if (InstanceRules.GetRolesForProperty(propertyName).ReadAllowed.Count > 0)
     {
         return(true);
     }
     return(TypeRules.GetRolesForProperty(propertyName).ReadAllowed.Count > 0);
 }
Beispiel #3
0
        /// <summary>
        /// Specify the roles denied read access to
        /// a given property.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="roles">List of roles denied read access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of denied roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void InstanceDenyRead(string propertyName, params string[] roles)
        {
            RolesForProperty currentRoles = InstanceRules.GetRolesForProperty(propertyName);

            foreach (string item in roles)
            {
                currentRoles.ReadDenied.Add(item);
            }
        }
Beispiel #4
0
 /// <summary>
 /// Indicates whether the current user as defined by
 /// <see cref="Csla.ApplicationContext.User" />
 /// is explicitly denied write access to the property.
 /// </summary>
 /// <param name="propertyName">Name of the property.</param>
 public bool IsWriteDenied(string propertyName)
 {
     System.Security.Principal.IPrincipal user = ApplicationContext.User;
     if (InstanceRules.GetRolesForProperty(propertyName).IsWriteDenied(user))
     {
         return(true);
     }
     return(TypeRules.GetRolesForProperty(propertyName).IsWriteDenied(user));
 }
Beispiel #5
0
        /// <summary>
        /// Specify the roles allowed to write a given
        /// property.
        /// </summary>
        /// <param name="propertyName">Name of the property.</param>
        /// <param name="roles">List of roles granted write access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of allowed roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void InstanceAllowWrite(string propertyName, params string[] roles)
        {
            RolesForProperty currentRoles = InstanceRules.GetRolesForProperty(propertyName);

            foreach (string item in roles)
            {
                currentRoles.WriteAllowed.Add(item);
            }
        }
        /// <summary>
        /// Specify the roles denied the right to execute
        /// a given method.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        /// <param name="roles">List of roles denied read access.</param>
        /// <remarks>
        /// This method may be called multiple times, with the roles in
        /// each call being added to the end of the list of denied roles.
        /// In other words, each call is cumulative, adding more roles
        /// to the list.
        /// </remarks>
        public void InstanceDenyExecute(string methodName, params string[] roles)
        {
            RolesForProperty currentRoles = InstanceRules.GetRolesForProperty(methodName);

            foreach (string item in roles)
            {
                currentRoles.ExecuteDenied.Add(item);
            }
        }
        /// <summary>
        /// Indicates whether the property has a list
        /// of roles denied execute access.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        public bool HasExecuteDeniedRoles(string methodName)
        {
            bool result = false;

            if (InstanceRules.GetRolesForProperty(methodName).ExecuteDenied.Count > 0)
            {
                result = true;
            }
            else
            {
                result = TypeRules.GetRolesForProperty(methodName).ExecuteDenied.Count > 0;
            }
            return(result);
        }
        /// <summary>
        /// Indicates whether the current user as defined by
        /// <see cref="YYT.ApplicationContext.User" />
        /// is explicitly denied execute access to the method.
        /// </summary>
        /// <param name="methodName">Name of the method.</param>
        public bool IsExecuteDenied(string methodName)
        {
            bool result = false;

            System.Security.Principal.IPrincipal user = ApplicationContext.User;
            if (InstanceRules.GetRolesForProperty(methodName).IsExecuteDenied(user))
            {
                result = true;
            }
            else
            {
                result = TypeRules.GetRolesForProperty(methodName).IsExecuteDenied(user);
            }
            return(result);
        }