public bool IsAllowedActionOnEntity(string actionCode, EntityTypeGUIDRecordUIDPair entityTypeUID) { if (_isSystemAdmin) { return(true); } int allow = 0; int retVal = ActionProcedures.CanUserExecActionOnEntity(entityTypeUID.EntityTypeGUID, entityTypeUID.RecordUID, _uid, actionCode, ref allow); if (allow == 1) { return(true); } //TODO, Make this a global settable flag. bool NotSetWillAllow = true; //If the value returned is not set, we chekc the gloabl flag to find out if user is allowed or not if (allow == -1) { if (NotSetWillAllow) { return(true); } else { return(false); } } return(false); }
public static Dictionary <string, bool> GetEffectiveEntityRecordPermissions(int userUID, EntityTypeGUIDRecordUIDPair eTypeUIDPair, List <int> groupUIDList) { //Create initial dictionary Dictionary <string, bool> effPerms = new Dictionary <string, bool>(); DataAccessAdapter da = new DataAccessAdapter(true); da.CloseConnection(); //Get Datatable of entitytype permissions for user DataTable userPerms = RetrievalProcedures.SelectUserRecordPermissions(eTypeUIDPair.EntityTypeGUID, eTypeUIDPair.RecordUID, userUID); assignAllowFromDataView(effPerms, userPerms.DefaultView); foreach (int gGUID in groupUIDList) { //Get Datatable of entitytype permissions for group gm DataTable groupPerms = RetrievalProcedures.SelectGroupRecordPermissions(eTypeUIDPair.EntityTypeGUID, eTypeUIDPair.RecordUID, gGUID); //If no prmissions for the EntityType, ignore and continue if (groupPerms.DefaultView.Count == 0) { continue; } assignAllowFromDataView(effPerms, groupPerms.DefaultView); } return(effPerms); }