Click or drag to resize

ShareFactoryFindAllRulesForSuperAdmin Method (IContext, String, NullableInt32, NullableGuid)

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,
	string objectType,
	Nullable<int> surveyId = null,
	Nullable<Guid> moduleGuid = null
)

Parameters

context
Type: AskiaPortalCmnIContext
Context of execution.
objectType
Type: SystemString
Type of objects to find.
surveyId (Optional)
Type: SystemNullableInt32
Id of the survey, to scope the search.
moduleGuid (Optional)
Type: SystemNullableGuid
GUID of the module that manage the objects (if null use the CurrentModule).

Return Value

Type: IEnumerableIShareRule
Return 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, new List<int$gt;{1, 2, 3});
foreach(var rule in rules)
{
    Console.WriteLine($@"The super administrator have the permission {rule.Permission} on the survey id `{rule.ObjectId}`");
}
See Also