ShareFactoryFindAllRulesForSuperAdmin Method (IContext, ShareObjectType, NullableInt32) |
Find or calculate all the appropriate share rules
for the specified object type and super-administrator.
Namespace:
AskiaPortalCmn
Assembly:
AskiaPortalCmn (in AskiaPortalCmn.dll) Version: 1.7.0-build068
Syntax public static IEnumerable<IShareRule> FindAllRulesForSuperAdmin(
IContext context,
ShareObjectType objectType,
Nullable<int> surveyId = null
)
Public Shared Function FindAllRulesForSuperAdmin (
context As IContext,
objectType As ShareObjectType,
Optional surveyId As Nullable(Of Integer) = Nothing
) As IEnumerable(Of IShareRule)
public:
static IEnumerable<IShareRule^>^ FindAllRulesForSuperAdmin(
IContext^ context,
ShareObjectType objectType,
Nullable<int> surveyId = nullptr
)
Parameters
- context
- Type: AskiaPortalCmnIContext
Context of execution. - objectType
- Type: AskiaPortalCmnShareObjectType
Type of objects to find. - surveyId (Optional)
- Type: SystemNullableInt32
Id of the survey, to scope the search.
Return Value
Type:
IEnumerableIShareRuleReturn the list of share rules
Remarks
The rules find could be database records
or calculated rules.
Examples
Find all share rules for surveys.
var context = ContextFactory.CreateByUserGuid(Guid.Parse("20BE5F84-F006-49A0-9674-4B16A090AF2D"));
var contextValidation = context.Validate();
if (!contextValidation.Success)
{
throw contextValidation.Exception;
}
var rules = ShareFactory.FindAllRulesForSuperAdmin(context, ShareObjectType.Survey);
foreach(var rule in rules)
{
Console.WriteLine($@"The super administrator have the permission {rule.Permission} on the survey id `{rule.ObjectId}`");
}
See Also