Exemple #1
0
 public bool verifyAccess(int minimumURole = WSConstants.ACCESS_LEVEL.READ)
 {
     if (!meta.Request.Security.IsLogged)
     {
         iostatus.AddNotes(new List <string> {
             "Authentication failed",
             "AuthRole:" + (meta.Request.Security.AuthToken == null?"notoken":meta.Request.Security.AuthToken.User == null?"nouser":"" + meta.Request.Security.AuthToken.User.role)
         });
     }
     else if (!meta.Request.Security.AuthToken.User.isactive)
     {
         iostatus.AddNote("User not permitted to access data, - user account is not activated. Please activate your acount and try again.", WSConstants.ACCESS_LEVEL.READ, WSStatus.ERROR.CODE);
     }
     else if ((meta.Request.Security.AuthToken.User.role < minimumURole))
     {
         iostatus.AddNote("User not permitted to access data. Minimum required access level for your request is: [" + minimumURole + "]", WSConstants.ACCESS_LEVEL.READ, WSStatus.ERROR.CODE);
     }
     else
     {
         return(true);
     }
     return(false);
 }