1. Script object OG.Person

    Article: AN0002183Updated:

    This object offers functions for reading metadata of ObjectGears users.

    Script functions

    Name Description
    bool IsUserAdmin() Function finds out if the user that is logged in is administrator of ObjectGears instance.
    bool IsUserITOwner(int modelId) Function finds out if the user that is logged in is IT owner of the model.
    Person GetLoginPerson() Function returns object Person of the user that is logged in.
    bool IsUserInRoleById(int roleId) Function finds out if the user that is logged in is assiged to the role and this role is enabled.
    bool IsUserInRoleByCode(string roleCode) Function finds out if the user that is logged in is assiged to the role and this role is enabled.
    bool IsUserInModelRoleById(int roleId, int modelId) Function finds out if the user that is logged in is assiged to the role and this role is enabled and enabled on model.
    bool IsUserInModelRoleByCode(string roleCode, int modelId) Function finds out if the user that is logged in is assiged to the role and this role is enabled and enabled on model.
    PersonList GetAll() Function returns list of all the users.
    Person GetById(int id) Function returns user according to the input Id.
    Person GetByAccount(string account) Function returns user according to the input account.
    Person GetFirstByCode(string code) Function returns the first found user according to his code.
    Person GetFirstByEmail(string email) Function returns the first found user according to his e-mail.
    PersonInfoList GetPersonInRolesById(int roleId) Function returns list of users according to the input ID of the role.
    PersonInfoList GetPersonInRolesByCode(string roleCode) Function returns list of users according to the input code of the role.
    PersonInfoList GetPersonInRolesById(string domain, int roleId) Function returns list of users according to the input ID of the role.
    PersonInfoList GetPersonInRolesByCode(string domain, string roleCode) Function returns list of users according to the input code of the role.
    PersonInfo CreatePersonInfo(int id) Function creates instance of PersonInfo and sets property Id. This function is suitable for setting up object proprety DataRow for storing into the database (Id only is used).
    PersonInfo CreatePersonInfo(int id, string displayName) Function creates instance of PersonInfo and sets property Id and DisplayName. This function is suitable for setting up object proprety DataRow for display in the form.
    Person CreatePerson(string account, string code, string fullName, string email) Function creates instance Person object without saving it into the database. It only returns it.
    void Save( Person person) Method saves the user into the database.
    bool IsUserInGroupById(int groupId) Function checks, whether the logged on user is member of the given group.
    bool IsUserInGroupByCode(string groupCode) Function checks, whether the logged on user is member of the given group.
    bool IsUserInGroupByCode(string groupCode, int personId) Function checks, whether the given user is member of the given group.
    bool IsUserInGroupById(int groupId, int personId) Function checks, whether the given user is member of the given group.

    By group we mean for functions InUserInGroup... assignment of the user in class defined by configuration parameter PersonGroupClassDefId. When non-existing Id or group code are entered, False is returned. When a function with logged on user is called without a logged on user, False is returned.

    Object call

    OG.Person

×