Exemplo n.º 1
0
 public bool isAccessGranted(PermissionToken tok)
 {
     if (PermissionTokens == null || PermissionTokens.Count == 0)
         return false;
     else
         return PermissionTokens.Contains(tok);
 }
Exemplo n.º 2
0
        public bool isAccessGranted(string formName, AccessType accessType)
        {
            if (PermissionTokens == null || PermissionTokens.Count == 0)
                return false;

            if (accessType.isTypeAny)
            {
                //is access granted for any accessType of the given formName?

                foreach(PermissionToken tok in PermissionTokens){
                    if (tok.FormName == formName)
                        return true;
                }
                return false;
            }
            else if (accessType.isTypeAll)
            {
                //is access granted for all accessTypes of the given formName?
                IList<PermissionToken> required =
                    PermissionToken.FindByFormName(formName);

                foreach (PermissionToken tok in required)
                {
                    if (!PermissionTokens.Contains(tok))
                        return false;
                }
                return true;
            }
            else
            {
                //is access granted for given accessType of the given formName?
                PermissionToken tok = new PermissionToken(formName, accessType);
                return PermissionTokens.Contains(tok);
            }
        }