/// <summary>
        /// Returns true if the logged in user is an admin, or if the user has the same UserId as the record
        /// </summary>
        public static bool CanEdit(this ClaimsPrincipal User, IUserBoundModel party)
        {
            if (User.IsAdmin())
            {
                return(true);
            }

            Guid PrimeUserId = User.GetPrimeUserId();

            return(!PrimeUserId.Equals(Guid.Empty) && PrimeUserId.Equals(party.UserId));
        }
Esempio n. 2
0
 public static PermissionsRecord PermissionsRecord(this IUserBoundModel model)
 {
     return(model == null ? null : new PermissionsRecord {
         UserId = model.UserId
     });
 }