icon Extranet Basic
Created by Orckestra

Extranet Developer Guide

Using Extranet Facade Methods

ExtranetFacade allows you to access and use almost all the methods that manage the Extranet functionality. By using the ExtranetFacade methods you can programmatically manage user accounts, user groups, assign users to groups and vice versa, add extranet security to websites and media folders as well as assign groups to pages and media files. You can also retrieve information about the extranet provider and manage logins and user validation on the extranet.

The public static ExtranetFacade class is part of the Composite.Community.Extranet.ExtranetFacade namespace.

You can use the ExtranetFacade methods when programmatically managing the default extranet provider as well as when developing your custom extranet providers.

The ExtranetFacade methods can be grouped as follows:

  • Managing extranet user accounts
  • Managing extranet user groups
  • Managing users-to-groups relations
  • Managing extranet on websites
  • Managing extranet on media folders
  • Managing extranet provider settings
  • Managing logins and validation

In the following few sections, you will learn more about methods in each of these groups.

Managing Extranet User Accounts

Managing the users includes creating and deleting user accounts in the extranet as well as getting and setting their properties, for example, passwords or activity statuses.

In most cases, you should have the name of the Extranet provider available, before you call any of these methods.

Often, before adding or updating a user account, you should create or get an instance of the IExtranetUser and set a number of its properties.

To get or update specific properties of a specific user account, you should use its user ID.

IExtranetUser

IExtranetUser holds the properties that provide the basic information about the extranet user account as well as allow you to set or update some of its values when you create or update a user account. Therefore, some of the values are assigned internally and are read-only while others can be changed in the code.

For example, the user ID is automatically assigned by the system whenever a new user account is created. All the date-based properties are also handled by the system and you can only read their values.

public interface IExtranetUser
{
    string Comment { get; set; }
    DateTime CreationDate { get; }
    string Email { get; set; }
    string FolderName { get; set; }
    Guid Id { get; }
    bool IsApproved { get; set; }
    bool IsLockedOut { get; }
    DateTime LastActivityDate { get; }
    DateTime LastLockedOutDate { get; }
    DateTime LastLoginDate { get; }
    DateTime LastPasswordChangeDate { get; }
    string Name { get; set; }
    string ProviderName { get; }
    string UserName { get; set; }
}

Properties

Id

The user ID (read-only)

Name

The user’s name (normally, the first and the last name)

UserName

The username used by the user to log in to the extranet

Email

The user’s email address

FolderName

The folder where the user is placed

Comment

Comment to the user account

IsApproved

An indication of whether the user is active

IsLockedOut

An indication of whether the user is locked out (read-only)

CreationDate

The date the user account was created (read-only)

LastActivityDate

The last date the user’s status was set to active (read-only)

LastLockedOutDate

The last date the user account was locked out (read-only)

LastLoginDate

The last date the user logged in to the extranet (read-only)

LastPasswordChangeDate

The last date the user’s password was changed (read-only)

ProviderName

The extranet provider’s name

AddNewUser

This method adds a new user to the extranet identified by its provider’s name. Before adding the user, you should initialize an IExtranetUser object setting its required properties.

public static IExtranetUser AddNewUser(string providerName, IExtranetUser user);

Parameters

providerName

The name of the Extranet provider

user

An IExtranetUser object

Return Value

The IExtranetUser object if the operation succeeds; otherwise, null.

GetUser (1)

This method retrieves the extranet user account as the IExtranetUser object if it can be found by its user ID in the extranet identified by its provider’s name. You can further query or use its specific properties.

public static IExtranetUser GetUser(string providerName, Guid userId);

Parameters

providerName

The name of the Extranet provider

userId

The user ID.

Return Value

The IExtranetUser object if the operation succeeds; otherwise, null.

GetUser (2)

This method retrieves the extranet user account as the IExtranetUser object if it can be found by its user ID in one of the extranets used on any existing website. You can further query or use its specific properties.

public static IExtranetUser GetUser(Guid userId);

Parameters

userId

The user ID.

Return Value

The IExtranetUser object if the operation succeeds; otherwise, null.

GetAllUsers

This method retrieves all extranet user accounts as a collection of IExtranetUser objects in the extranet identified by its provider’s name.

public static IEnumerable<IExtranetUser> GetAllUsers(string providerName);

Parameters

providerName

The name of the Extranet provider

Return Value

A collection of IExtranetUser objects that can be iterated.

GetUserId

This method gets the user’s ID by the login name (username) in the extranet identified by its provider’s name.

public static Guid GetUserId(string providerName, string login);

Parameters

providerName

The name of the Extranet provider

login

The name used to log in to the extranet (login, username)

Return Value

The GUID assigned to this user account.

GetUserPassword

This method gets the user’s password by the login name (username) in the extranet identified by its provider’s name.

public static string GetUserPassword(string providerName, string login);

Parameters

providerName

The name of the Extranet provider

login

The username used to log in to the extranet

Return Value

A string that holds the user’s password.

GetCurrentUser

This method returns the current user of the extranet identified by its provider’s name.

public static IExtranetUser GetCurrentUser(string providerName);

Parameters

providerName

The name of the extranet provider the current user account of which is retrieved.

Return Value

An IExtranetUser object if there is the current user in the extranet; otherwise, null.

GetCurrentUserId

This method returns the current user’s ID.

public static Guid GetCurrentUserId();

Return Value

A GUID that specifies the current user’s ID.

GetCurrentUserName

This method returns the name of the current user of the extranet identified by its provider’s name.

public static string GetCurrentUserName(string providerName);

Parameters

providerName

The name of the extranet provider the name of the current user account of which is retrieved.

Return Value

A string that specifies the current extranet user’s name.

UpdateUser

This method updates settings of an existing user account in the extranet identified by its provider’s name. Before updating the user account’s settings, you should get the existing user account as an IExtranetUser object and modify the desired properties with new values.

public static void UpdateUser(string providerName, IExtranetUser user);

Parameters

providerName

The name of the Extranet provider.

user

An IExtranetUser object

SetUserPassword

This method (re)sets the password of an existing user account by the user ID in the extranet identified by its provider’s name.

public static bool SetUserPassword(string providerName, Guid userId, string newPassword);

Parameters

providerName

The name of the Extranet provider.

userId

The user’s ID.

newPassword

The new password for the user

Return Value

If the password is successfully changed, it returns true; otherwise, false.

UserActivity

This method sets the user account’s status to active in the extranet identified by its provider’s name. Unless the user account is locked out, the user can log on to the extranet with his or her credentials. The user account is identified by ist user ID.

public static void UserActivity(string providerName, Guid userId);

Parameters

providerName

The name of the Extranet provider.

userId

The user’s ID.

SetUserIsLockedOut

This method locks out the existing user account in the extranet identified by its provider’s name. If the user account is locked out, the user cannot log on to the extranet. The user account is identified by its user ID.

public static void SetUserIsLockedOut(string providerName, Guid userId, bool lockedOut);

Parameters

providerName

The name of the Extranet provider.

userId

The user’s ID.

lockedOut

If true, the user account gets locked out; otherwise, unlocked out.

Deleting Users

This method deletes an existing user account by the user ID in the extranet identified by its provider’s name.

public static void DeleteUser(string providerName, Guid userId);

Parameters

providerName

The name of the Extranet provider.

userId

The user’s ID.

Managing Extranet User Groups

Like managing extranet user accounts, managing the user groups includes creating and deleting groups in the extranet as well as getting and setting their properties, for example, their names or their permissions.

In most cases, you should have the name of the Extranet provider available, before you call any of these methods.

Often, before adding or updating a user account, you should create or get an instance of the IExtranetGroup and set a number of its properties.

To get or update specific properties of a specific user group, you should use its group ID.

Extranet Group

IExtranetGroup provides access to the properties of an extranet user group as well as allow you to set or update some of its values when you create or update a user group. The group ID is automatically assigned by the system whenever a new user group is created and is thus read-only.

public interface IExtranetGroup
{
    bool CanBeAssignedAccessRight { get; set; }
    string Description { get; set; }
    Guid Id { get; }
    bool MemberGroupsUpdatable { get; set; }
    bool MemberUsersUpdatable { get; set; }
    string Name { get; set; }
    Guid? ParentGroupId { get; set; }
    string ProviderName { get; set; }
}

Properties

Id

The group ID (read-only)

ParentGroupId

The parent group’s ID. If null, the group is a root group.

Name

The group’s name

Description

The group’s description

MemberUsersUpdatable

If true, users can be added to, or deleted from, this group

MemberGroupsUpdatable

If true, sub-groups can be added to, or deleted from, this group

CanBeAssignedAccessRights

If true, this group can be used to grant or revoke access on websites and pages and media folders and files

ProviderName

The extranet provider’s name

Extranet Group Hierarchy Node

IExtranetGroupHierarchyNode extends IExtranetGroup by providing an enumerator to the collection of sub-groups (if any) in the group as their parent group.

By using IExtranetGroupHierarchyNode you can access not only properties of the current user groups but also those of all its sub-groups if any.

public interface IExtranetGroupHierarchyNode : IExtranetGroup
{
    IEnumerable<IExtranetGroupHierarchyNode> Groups { get; }
}

Properties

Groups

An enumerable collection of sub- groups as IExtranetGroupHierarchyNode objects

AddNewGroup

This method adds a new group to the extranet identified by its provider’s name. Before adding the group, you should initialize an IExtranetGroup object setting the required properties.

public static IExtranetGroup AddNewGroup(string providerName, IExtranetGroup group);

Parameters

providerName

The name of the Extranet provider

group

An initialized IExtranetGroup object

Return Value

The IExtranetGroup object if the operation succeeds; otherwise, null.

GetGroup

This method retrieves the extranet user group as the IExtranetGroup object by its group ID, which allows you to further query or use its specific properties. It requires the extranet provider’s name.

public static IExtranetGroup GetGroup(string providerName, Guid groupId);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

Return Value

The IExtranetGroup object if the operation succeeds; otherwise, null.

GetRootGroup

This method retrieves the root group of an existing group by the latter’s ID. The root group is retrieved as the IExtranetGroupHierarchyNode object, which allows you to further iterate its sub-groups and query or use their specific properties. It requires the extranet provider’s name.

public static IExtranetGroupHierarchyNode GetRootGroup(string providerName, Guid groupId);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

Return Value

The IExtranetGroupHierarchyNode object if the operation succeeds; otherwise, null.

GetGroupHierarchy (1)

This method retrieves an existing group as the IExtranetGroupHierarchyNode object by its group ID, which allows you to further iterate its sub-groups and query or use their specific properties. It requires the extranet provider’s name.

public static IExtranetGroupHierarchyNode GetGroupHierarchy(string providerName, Guid groupId);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

Return Value

The IExtranetGroupHierarchyNode object if the operation succeeds; otherwise, null.

GetGroupHierarchy (2)

This method retrieves all the existing groups as an enumerable collection of IExtranetGroupHierarchyNode objects (hierarchy), which allows you to further iterate its sub-groups and query or use their specific properties. It requires the extranet provider’s name.

public static IEnumerable<IExtranetGroupHierarchyNode> GetGroupHierarchy(string providerName);

Parameters

providerName

The name of the Extranet provider.

Return Value

An enumerable collection of IExtranetGroupHierarchyNode objects if the operation succeeds; otherwise, null.

GetGroupSelectOptions

This method retrieves all the groups that can be assigned to web pages and media folders and files as an enumerable collection of key/value pairs with group IDs and group names. The values can be further used, for example, in the selector widgets.

You can configure whether the group name should be a “short” name or a “long” name. The long name includes the short name (the name of the group) and the path to the group from the root group in the group hierarchy.

You can also indicate whether the root group should be retrieved as well.

public static IEnumerable<KeyValuePair<Guid, string>> GetGroupSelectOptions(string providerName, bool allGroups, bool longNames);

Parameters

providerName

The name of the Extranet provider.

allGroups

This parameter indicates whether the root group should be retrieved along with all the sub-groups.

longNames

This parameter indicates whether the group names should include the hierarchical “paths” (short names vs. long names)

Return Value

An enumerable collection of key/value pairs with group IDs and group names if the operation succeeds; otherwise, null.

GroupLongName

This method gets a “long” name of an existing group by its ID as a path that includes names of all the parent groups separated by the specified delimiter. It requires the extranet provider’s name.

public static string GroupLongName(string providerName, Guid groupId, string delimiter);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

delimiter

A character used for separating groups in the path (e.g. “/”)

Return Value

A long name of the group, which includes the names of its parent groups in the group hierarchy.

UpdateGroup

This method updates properties of an existing group in the extranet identified by its provider’s name. Before updating the group, you should get the existing group as an IExtranetGroup object and modify the desired properties with new values.

public static void UpdateGroup(string providerName, IExtranetGroup group);

Parameters

providerName

The name of the Extranet provider.

group

An IExtranetGroup object.

DeleteGroup

This method deletes an existing group in the extranet identified by its provider’s name. The group is identified by its group ID.

public static void DeleteGroup(string providerName, Guid groupId);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

ValidateUserGroupsToItemGroups

This method validates the user groups as a collection of their group IDs against the extranet-protected data items (such as web page or media files) as a collection of their item IDs in the extranet identified by its provider’s name.

The validation result is used to determine whether the user as a member of the specified groups has access to the specified items.

The method can be used not only with web pages and media files but also with any custom items that can be protected with the extranet.

public static bool ValidateUserGroupsToItemGroups(string providerName, IEnumerable<Guid> userGroups, IEnumerable<Guid> itemGroups);

Parameters

providerName

The current extranet provider’s name

userGroups

An enumerable collection of group IDs

itemGroups

An enumerable collection of IDs of items such as pages, media files or custom data items

Return Value

If the validation is successful, it returns true; otherwise, false.

Managing Relations between Users and Groups

In the Extranet add-on the user can be a member of multiple groups. The opposite is also true - the group can have multiple users. Using the ExtranetFacade methods, you can assign a user to a number of groups and a group to a number of users. Besides, you can get a list of users in a specific group as well as a list of groups of which the user is a member.

GetUsersFromGroup

This method gets user accounts as an enumerable collection of IExtranetUser objects, assigned to a group identified by its group ID. You can further iterate this collection and query or use the specific user’s properties. It requires the extranet provider’s name.

public static IEnumerable<IExtranetUser> GetUsersFromGroup(string providerName, Guid groupId);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

Return Value

A collection of IExtranetUser objects if the operation succeeds; otherwise, null.

GetGroupIdListForUser

This method gets groups as an enumerable collection of group IDs, to which a user identified by its user ID is assigned. You can further iterate the collection and use these group IDs. It requires the extranet provider’s name.

public static IEnumerable<Guid> GetGroupIdListForUser(string providerName, Guid userId);

Parameters

providerName

The name of the Extranet provider.

userId

The user’s ID.

Return Value

A collection of group IDs (GUIDs) if the operation succeeds; otherwise, null.

SetGroupsForUsers

This method assigns a collection of groups identified by their group IDs to a user identified by its user ID. You should first build an enumerable collection of existing groups and then pass it as one of the method’s input parameters. The method also requires the extranet provider’s name.

public static void SetGroupsForUser(string providerName, Guid userId, IEnumerable<Guid> groupIdList);

Parameters

providerName

The name of the Extranet provider

userId

The user’s ID

groupIdList

A collection of group IDs

SetUsersForGroups

This method assigns a collection of users identified by their user IDs to a group identified by its group ID. You should first build an enumerable collection of existing users and then pass it as one of the method’s input parameters. The method also requires the extranet provider’s name.

public static void SetUsersForGroup(string providerName, Guid groupId, IEnumerable<Guid> userIdList);

Parameters

providerName

The name of the Extranet provider.

groupId

The group’s ID.

userIdList

A collection of user IDs

Managing Extranet Security on Websites

The usual scenario for managing extranet security on a website is as follows:

  1. The extranet security is assigned to a website (the root, or home, page). This includes specifying the extranet provider and the page that will be used for user to log in to the extranet (a “Login” page).
  2. One or more extranet groups are assigned to pages (which automatically includes all its sub-pages) to control what users in these groups can or cannot access on the website.

In the first case, you will need to initialize or use an IPageExtranet object, which includes the required information on the provider, login page and the root page ID.

In the second case, you will create or use an IPageSecurity object that holds necessary information about the extranet, page and security implemented by assigning a specific group to the page.

A number of methods are provided in the ExtranetFacade for managing the extranet security on websites.

IPageExtranet

IPageExtranet extends IData with properties that hold information about the extranet settings for a website (identified by its root page ID), which include the extranet provider’s name and the Login page ID.

public interface IPageExtranet : IData
{
    Guid LoginPageId { get; set; }
    Guid PageId { get; set; }
    string ProviderName { get; set; }
}

Properties

PageId

The website’s root page ID

ProviderName

The extranet provider’s name

LoginPageID

The ID of the page used to log in to the extranet

IPageSecurity

IPageSecurity extends IData with properties that hold information about the extranet security settings for a web page (identified by its page ID), which include the ID of the extranet group assigned to this page as well as the extranet ID (root page ID) and its provider’s name.

public interface IPageSecurity : IData
{
   Guid Id { get; set; }
   Guid ExtranetId { get; set; }
   string ProviderName { get; set; }
   Guid PageId { get; set; }
   Guid GroupId { get; set; }
}

Properties

Id

The page security ID

ExtranetId

The extranet ID, which is the extranet-protected website’s root page ID

ProviderName

The extranet provider’s name

PageId

The page ID

GroupID

The ID of the extranet group assigned to the page

AddNewExtranetToPage

This method adds the extranet settings to the website identified by its root page ID. The extranet settings include the extranet provider’s name and ID of the page used to log in to the extranet.

public static void AddNewExtranetToPage(Guid pageId, string providerName, Guid selectedLoginPage);

Parameters

pageId

The website’s root page ID

providerName

The extranet provider’s name

selectedLoginPage

The ID of the page used to log in to the extranet

GetExtranetToPage (1)

This method gets the extranet settings as an IPageExtranet object on a website identified by its root page ID.

public static IPageExtranet GetExtranetToPage(Guid pageId);

Parameters

pageId

The website’s root page ID

Return Value

An IPageExtranet object if the ID is that of the website’s root page; otherwise, null.

GetExtranetToPage (2)

This method gets the extranet settings of all the websites as a queryable collection of IPageExtranet objects.

public static IQueryable<IPageExtranet> GetExtranetToPage();

Return Value

A queryable collection of IPageExtranet objects if one or more websites are extranet-protected; otherwise, an empty collection.

GetExtranetToPageByLoginPageId

This method gets the extranet settings as an IPageExtranet object by its Login page ID.

public static IPageExtranet GetExtranetToPageByLoginPageId(Guid pageId);

Parameters

pageId

The ID of the page used for logins to the extranet

Return Value

An IPageExtranet object if the ID is that of the Login page used in the extranet; otherwise, null.

GetCurrentExtranet

This method gets current extranet settings as an IPageExtranet object in the context of the current website. You can further query the object for the provider’s name, the website’s root page ID and Login page ID.

public static IPageExtranet GetCurrentExtranet();

Return Value

An IPageExtranet object if extranet set up on the current website; otherwise, null.

GetRootPageInExtranet

This method gets the extranet settings as an IPageExtranet object for a specific page on website identified by its page ID.

public static IPageExtranet GetRootPageInExtranet(Guid pageId);

Parameters

pageId

The page ID

Return Value

An IPageExtranet object if the page is on an extranet-protected website; otherwise, null.

GetCurrentLoginPage

This method gets the ID of the Login page used in the extranet on the current website.

public static Guid GetCurrentLoginPage();

Return Value

The Login page ID.

UpdateExtranetToPage

This method updates extranet settings of a page. Before calling this method, you should initialize IPageExtranet object with desired values and then pass it as an input parameter.

public static void UpdateExtranetToPage(IPageExtranet extranet);

Parameters

extranet

An IPageExtranet object

DeleteExtranetToPage

This method deletes extranet settings from the website identified by its root page ID.

public static void DeleteExtranetToPage(Guid pageId);

Parameters

pageId

The page’s ID

GetPageSecurityPages

This method gets all the pages protected by an extranet group identified by its group ID in the extranet identified by its provider’s name. The pages are returned as an enumerable collection of IPageSecurity objects.

public static IEnumerable<IPageSecurity> GetPageSecurityPages(string providerName, Guid groupId);

Parameters

providerName

The extranet provider’s name

groupID

The extranet group’s ID

Return Value

An enumerable collection of IPageSecurity objects if the group is assigned to any page; otherwise, an empty collection.

SetPageSecurityGroups

This method assigns a list of extranet groups as a collection of group IDs to the page identified by its page ID. The extranet should be identified by its provider’s name.

public static void SetPageSecurityGroups(string providerName, Guid extranetId, Guid pageId, IEnumerable<Guid> groupIdList);

Parameters

providerName

The extranet provider’s name

extranetId

The ID of the root page on a website

pageId

The page ID

groupIdList

An enumerable collection of group IDs to be assigned to the page

GetPageSecurityGroups

This method retrieves the groups as an enumerable collection of group IDs from a page by its page ID in the extranet identified by its provider’s name.

public static IEnumerable<Guid> GetPageSecurityGroups(string providerName, Guid pageId);

Parameters

providerName

The extranet provider’s name

pageId

The page’s ID

Return Value

An enumerable collection of group IDs if any groups are assigned to the page; otherwise, an empty collection.

GetPageSecurityInheritedGroups

This method retrieves the groups inherited from all the parent pages as an enumerable collection of group IDs for a page identified by its page ID in the extranet identified by its provider’s name.

public static IEnumerable<Guid> GetPageSecurityInheritedGroups(string providerName, Guid pageId);

Parameters

providerName

The extranet provider’s name

pageId

The page ID

Return Value

An enumerable collection of group IDs if any groups are inherited on the page; otherwise, an empty collection.

DeleteGroupFromPageSecurity

This method deletes an existing group identified by its group ID from all the pages protected by the extranet identified by its provider’s name.

public static void DeleteGroupFromPageSecurity(string providerName, Guid groupId);

Parameters

providerName

The extranet provider’s name

groupId

The group ID

GetExtranetSitemapXml

This method gets the XML-formatted site map in the context of the current extranet for the groups identified by their group IDs.

You can configure the sitemap by indicating whether to exclude the restricted pages from the sitemap as well as whether to include additional attributes for each active page (active page annotations) and attributes that will list the groups assigned to each page (as group IDs).

public static IEnumerable<XElement> GetExtranetSitemapXml(IEnumerable<Guid> groups, bool removeBlockedPages, bool addGroups, bool activePageAnnotations);

Parameters

groups

An enumerable collection of group IDs

removeBlockedPages

The parameter that indicates whether to exclude the restricted pages from the sitemap

addGroups

The parameter that indicates whether to include attributes that will list the groups assigned to each page (as group IDs).

activePageAnnotations

The parameter that indicates whether to include additional attributes for each active page (e.g. “isopen”, “iscurrent”) in the sitemap

Return Value

An XML-formatted site map.

Managing Extranet Security on Media

The extranet security can be applied not only to websites but also to media folders and, thus, media files. The methods used on media are similar to those used on websites and web pages.

The usual scenario for managing extranet security on media is as follows:

  1. The extranet security is assigned to a media folder. This includes specifying an extranet provider and the ID of the website’s root page (extranet ID) as well as the path to the media folder to protect.
  2. One or more extranet groups are assigned to media folders or files (which automatically includes all its sub-folders and files) to control what users in these groups can or cannot access.

In the first case, you will need to initialize or use an IMediaExtranet object, which includes the required information on the provider, the extranet-protected website and the path to a media in the Media Archive.

In the second case, you will create or use an IMediaSecurity object that holds necessary information about the extranet provider, extranet-protected website, media file or folder and security implemented by assigning a specific group to the media.

A number of methods are provided in the ExtranetFacade for managing the extranet security on media.

IMediaExtranet

IMediaExtranet extends IData with properties that hold information about the extranet settings for media (identified by its media path), which include the extranet provider’s name and the extranet ID and the path to the media.

public interface IMediaExtranet : IData
{
    string CompositePath { get; set; }
    Guid ExtranetId { get; set; }
    string ProviderName { get; set; }
}

Properties

CompositePath

The path to a media folder in the Media Archive

ExtranetID

The ID of the root page on an extranet-protected website

ProviderName

The extranet provider’s name

IMediaSecurity

IMediaSecurity extends IData with properties that hold information about the extranet security settings for a media (identified by its path), which include the ID of the extranet group assigned to this page as well as the extranet ID and its provider’s name.

public interface IMediaSecurity : IData
{
   Guid Id { get; set; }
   Guid ExtranetId { get; set; }
   string ProviderName { get; set; }
   string CompositePath{ get; set; }
   Guid GroupId { get; set; }
}

Properties

Id

The media security ID

ExtranetId

The ID of the root page on an extranet-protected website

ProviderName

The extranet provider’s name

CompositePath

The path to a media file or folder in the Media Archive

GroupID

The ID of the extranet group assigned to the media

AddNewExtranetToMedia

This method adds the extranet settings to a media folder at the specified path. The extranet settings include the extranet provider’s name and the ID of the root page on an extranet-protected website.

public static void AddNewExtranetToMedia(string compositePath, string providerName, Guid ExtranetId);

Parameters

compositePath

The path to a media folder

providerName

The extranet provider’s name

extranetID

The ID of the root page on an extranet-protected website

GetExtranetToMedia

This method gets all the extranet settings of all media folders in the media archive as a queryable collection of IMediaExtranet objects.

public static IQueryable<IMediaExtranet> GetExtranetToMedia();

Return Value

A queryable collection of IMediaExtranet objects if any folder is extranet-protected; otherwise, an empty collection.

GetExtranetToMedia

This method gets the extranet settings as an IMediaExtranet object from a media folder at the specified path.

public static IMediaExtranet GetExtranetToMedia(string compositePath);

Parameters

compositePath

The path to a media folder

Return Value

An IMediaExtranet object if the media folder is extranet-protected; otherwise, null.

UpdateExtranetToMedia (1)

This method updates extranet settings of a media folder. Before calling this method, you should create and initialize IMediaExtranet object and then pass it as an input parameter.

public static void UpdateExtranetToMedia(IMediaExtranet extranet);

Parameters

extranet

An IPageExtranet object

DeleteExtranetToMedia (2)

This method deletes extranet settings from a media folder at the specified path.

public static void DeleteExtranetToMedia(string compositePath);

Parameters

compositePath

The path to a media folder

GetRootMediaInExtranet

This method gets the root extranet-protected media folder as an IMediaExtranet object for a media at the specified path.

public static IMediaExtranet GetRootMediaInExtranet(string compositePath);

Parameters

compositePath

The path to a media

Return Value

An IMediaExtranet object, if the media file or folder is located in the extranet-protected folder; otherwise, null.

GetSubMediaInExtranet

This method detects whether the media folder at the specified path contains an extranet-protected area in the Media Archive.

public static IMediaExtranet GetSubMediaInExtranet(string compositePath);

Parameters

compositePath

The path to a media

Return Value

An IMediaExtranet object, if the media folder contains an extranet-protected media area; otherwise, null.

GetMediaSecurityMedia

This method gets all the media folders protected by an extranet group identified by its group ID in the extranet identified by its provider’s name. The media folders are returned as an enumerable collection of IMediaSecurity objects.

public static IEnumerable<IMediaSecurity> GetMediaSecurityMedia(string providerName, Guid groupId);

Parameters

providerName

The extranet provider’s name

groupID

The extranet group ID

Return Value

An enumerable collection of IMediaSecurity objects if at least one media folder is extranet protected; otherwise, an empty collection.

GetMediaSecurityGroups

This method retrieves the groups as an enumerable collection of group IDs from a media by its path in the extranet identified by its provider’s name.

public static IEnumerable<Guid> GetMediaSecurityGroups(string providerName, string CompositePath);

Parameters

providerName

The extranet provider’s name

CompositePath

The path to a media folder or file

Return Value

An enumerable collection of group IDs if any media is protected by any group; otherwise, an empty collection.

GetMediaSecurityInheritedGroups

This method retrieves the groups inherited from parent media folders as an enumerable collection of group IDs from a media by its path in the extranet identified by its provider’s name.

public static IEnumerable<Guid> GetMediaSecurityInheritedGroups(string providerName, string CompositePath);

Parameters

providerName

The extranet provider’s name

CompositePath

The path to a media folder

Return Value

An enumerable collection of group IDs if any media is protected by any inherited group; otherwise, an empty collection.

SetMediaSecurityGroups

This method assigns a list of extranet groups as group IDs to the media identified by its media ID. The extranet should be identified by its provider’s name and the ID of the root page on an extranet-protected website.

public static void SetMediaSecurityGroups(string providerName, Guid extranetId, string mediaId, IEnumerable<Guid> groupIdList);

Parameters

providerName

The extranet provider’s name

extranetId

The ID of the extranet

mediaId

The media ID

groupIdList

An enumerable collection of group IDs to be assigned to the media

DeleteGroupFromMediaSecurity

This method deletes an existing group by its group ID from all the media folders and files in the Media Archive.

public static void DeleteGroupFromMediaSecurity(string providerName, Guid groupId);

Parameters

providerName

The extranet provider’s name

groupId

The group ID

GetExtranetMediaArchiveSitemapXml

This method gets the XML-formatted site map in the context of the current extranet for the groups identified by their group IDs.

You can configure the sitemap by indicating whether to exclude the restricted media from the sitemap as well as whether to include attributes that will list the groups assigned to each media (as group IDs).

public static IEnumerable<XElement> GetExtranetMediaArchiveSitemapXml(IEnumerable<Guid> userGroups, bool removeBlockedMedia, bool addGroups);

Parameters

userGroups

An enumerable collection of group IDs

removeBlockedMedia

The parameter that indicates whether to exclude the restricted media from the site map

addGroups

The parameter that indicates whether to include attributes that will list the groups assigned to each media (as group IDs).

 

Return Value

An XML-formatted site map.

Managing Extranet Settings

Each extranet provider has a number of properties that can be read and used in the code by some of the ExtranetFacade methods.

IExtranetProviderSettings

IExtranetProviderSettings provides information about the extranet provider, which includes its name and title and indictates whether user accounts and user groups can be updated, passwords read, or the Forms Authentication supported.

All the properties are read-only.

public interface IExtranetProviderSettings
{
    bool FormsLoginSupported { get; }
    bool GroupsUpdatable { get; }
    string Name { get; }
    string Title { get; }
    bool UserPasswordsReadable { get; }
    bool UsersUpdatable { get; }
}

Properties

Name

The name of the extranet provider by which the latter is referred to in the code (read-only)

Title

The title of the extranet provider by which the latter is visible to end users in the GUI (read-only)

FormsLoginSupported

The property that indicates whether the Forms Authentication is supported (read-only)

UsersUpdatable

The property that indicates whether changes in a user account’s settings are allowed (read-only)

GroupsUpdatable

The property that indicates whether changes in a user group’s settings are allowed (read-only)

UserPasswordsReadable

The property that indicates whether reading user passwords is allowed (read-only)

GetCurrentProviderName

This method returns the current extranet provider’s name. The name is used internally in the code.

public static string GetCurrentProviderName();

Return Value

A string that specifies the current extranet provider’s name.

GetCurrentProviderTitle

This method returns the current extranet provider’s title. The title is used externally in the GUI.

public static string GetCurrentProviderTitle();

Return Value

A string that specifies the current extranet provider’s title.

GetDefaultProviderName

This method returns the default extranet provider’s name. The name is used internally in the code.

public static string GetDefaultProviderName();

Return Value

A string that specifies the default extranet provider’s name.

GetProviderSettings (1)

This method retrieves the settings for all the extranet providers as an enumerable collection of IExtranetProviderSettings objects.

public static IEnumerable<IExtranetProviderSettings> GetProviderSettings();

Return Value

An enumerable collection of IExtranetProviderSettings objects.

GetProviderSettings (2)

This method retrieves the settings as an IExtranetProviderSettings object for the extranet identified by its provider’s name.

public static IExtranetProviderSettings GetProviderSettings(string providerName);

Parameters

providerName

The name of the extranet provider whose settings are retrieved.

Return Value

An IExtranetProviderSettings object that holds the provider’s settings.

Managing Logins and Validation

A number of methods are used for the front-end operations such as logging in and out as well as validating users and groups.

Login

This method logs the user with the specified username and password in to the extranet. You can specify whether to keep the user logged in (“remember”) between sessions and whether to refresh the page the user has come from to update the login status.

public static bool Login(string userName, string password, bool rememberMe, bool refreshOnLogin);

Parameters

userName

The name of the user to log in with to the extranet

password

The password of the user to use when logging in to the extranet

rememberMe

This parameter indicates whether to keep the user logged in between sessions

refreshOnLogin

This parameter indicates whether to refresh the page the user has come from to update the login status

Return Value

It the user logs in to the extranet, it returns true; otherwise, false.

Logout

This method logs the current user out of the extranet.

public static void Logout();

IsAuthenticated

This method indicates whether the user in the current context is authenticated on the extranet.

public static bool IsAuthenticated();

Return Value

If the user is authenticated, it returns true; otherwise, false.

ValidateUser

This method validates the user’s credentials such as the username and password against the user accounts in the extranet identified by the provider’s name. If the validation succeeds, the method returns the user’s ID in its corresponding output parameter, which can be further used in the code to refer to the user.

public static bool ValidateUser(string providerName, string login, string password, out Guid userId);

Parameters

providerName

The current extranet provider’s name

login

The name of the user to log in with to the extranet

password

The password of the user to use when logging in to the extranet

userId

[out] The user’s ID in the extranet returned if the validation is successful.

Return Value

If the validation is successful, it returns true; otherwise, false.

 
Back to top
Part of subscriptions:

Have a question?

Phone: +45 39 15 76 00
Email: Write us
5:26 AM
(Local time at HQ)