/// <summary> /// Verifies access to a plugin for the specified identity /// </summary> /// <param name="objectName">the object for which to verify the access</param> /// <param name="userIdentity">the identity for which to check the access</param> /// <param name="reason">returns a reason, why the access was denied</param> /// <returns>a value indicating whether the provided user has access to the requested object</returns> public bool VerifyAccess(string objectName, IIdentity userIdentity, out string reason) { bool retVal = false; reason = "the object is unknown"; if (factory.Contains(objectName) && userIdentity != null) { retVal = true; reason = string.Empty; var obj = factory[objectName]; var type = obj.GetType(); HasPermissionAttribute[] securityAttributes = type.GetCustomAttributes(typeof(HasPermissionAttribute)).Cast <HasPermissionAttribute>().ToArray(); if (securityAttributes.Length != 0) { retVal = VerifyPermissions(userIdentity, securityAttributes, out reason); } } return(retVal); }