
Static Public Member Functions | |
| static | can ($what, $uid= '') |
| Determines whether user is permitted to execute requested action. | |
| static | checkInit () |
| Checks if TSD has been initialized. | |
| static | getAlignments ($url, $mode=TSD::MODE_LIVE) |
| Retrieves all alignments for a given CSERD ID or URL. | |
| static | getDBI () |
| Retrieves the DBI object connected to the CSERD database. | |
| static | getLocalDBI () |
| Retrieves the DBI object connected to the TSD database. | |
| static | getParties () |
| Retrieves list of all users who have been granted any permissions. | |
| static | init () |
| Initializes the TSD API and connects to the database. | |
| static | log ($description, $query) |
| INSERT BRIEF DESCRIPTION HERE. | |
| static | setPermission ($uid, $which, $how) |
| Modifies permission for user. | |
| static | stringToMode ($modeString) |
| Converts descriptive name of mode to constant value. | |
Public Attributes | |
Mode constants | |
| const | MODE_ALL |
| all versions | |
| const | MODE_APPROVED |
| dev versions that are marked APPROVED | |
| const | MODE_CHANGED |
| dev versions that are marked CHANGED | |
| const | MODE_DELETED |
| dev versions that are marked DELETED | |
| const | MODE_DEV |
| dev versions (of any status) | |
| const | MODE_DEV_ACTIVE |
| dev versions excluding DELETED | |
| const | MODE_DEV_UNAPPROVED |
| dev versions excluding APPROVED | |
| const | MODE_LIVE |
| live versions (always approved) | |
| const | MODE_NEW |
| dev versions that are marked NEW | |
Status constants | |
| const | STATUS_APPROVED |
| alignment/relationship that is visible on live site | |
| const | STATUS_CHANGED |
| alignment/relationship that has been modified | |
| const | STATUS_DELETED |
| alignment/relationship that has been marked for deletion | |
| const | STATUS_NEW |
| newly created alignment/relationship | |
Version constants | |
| const | VERSION_DEV |
| dev version of alignment/relationship | |
| const | VERSION_LIVE |
| live version of alignment/relationship (status must be TSD::STATUS_APPROVED) | |
Static Private Member Functions | |
| static | getCurrentUser () |
| Gets the user ID of the currently logged in user, if any. | |
This class provides TSD initialization functions, permission functions and a few utility functions. It is meant to be a static (singleton) class and cannot be instantiated.
Definition at line 11 of file TSD.php5.
| static TSD::can | ( | $ | what, | |
| $ | uid = '' | |||
| ) | [static] |
Determines whether user is permitted to execute requested action.
The available actions are: 'edit', 'approve' and 'align'. These permissions are checked by the API when making TSD-modifying calls, and also by the TSD admin tool. No permissions are checked for reading from the database.
| $what | [string]: which of the three available actions listed above is to be checked for | |
| $uid | [int]: user ID of the user to check permission for; defaults to current user |
Definition at line 210 of file TSD.php5.
References SObject::getError().
Referenced by TSDObject::__call(), TSDStandardGrade::addCategory(), TSDBook::addChapter(), TSDStandardOrganization::addGrade(), TSDLeaf::align(), TSDRelation::approve(), TSDLeaf::approveAlignments(), TSDRelation::cancel(), TSDLeaf::cancelAlignments(), TSDRelation::commit(), TSDRelation::delete(), TSDObject::delete(), TSDStandardGrade::deleteCategoryByName(), TSDBook::deleteChapterByName(), TSDStandardOrganization::deleteGradeByName(), TSDObject::set(), TSDBook::setCoverImage(), TSDLeaf::unalign(), and TSDBook::uploadCoverImage().
| static TSD::checkInit | ( | ) | [static] |
Checks if TSD has been initialized.
For internal use only.
If it has not, it calls init() and if that still fails, then returns null. This way, API calls won't proceed unless TSD is guaranteed to be initialized.
Definition at line 87 of file TSD.php5.
Referenced by TSDObject::checkInit().
| static TSD::getAlignments | ( | $ | url, | |
| $ | mode = TSD::MODE_LIVE | |||
| ) | [static] |
Retrieves all alignments for a given CSERD ID or URL.
You can provide either a URL or an ID. This method just calls getResourceAlignments() on TSDText, TSDStandard and TSDWord for the same URL/ID and concatenates the results. It is thus merely a convenience method.
| $url | [mixed]: CSERD URL or CSERD ID | |
| $mode | [int]: alignment mode: only retrieve alignments matching this mode (one of the TSD::MODE_* constants) |
Definition at line 136 of file TSD.php5.
References TSDWord::getResourceAlignments(), TSDStandard::getResourceAlignments(), and TSDText::getResourceAlignments().
| static TSD::getCurrentUser | ( | ) | [static, private] |
| static TSD::getDBI | ( | ) | [static] |
Retrieves the DBI object connected to the CSERD database.
All TSD nodes and alignments are stored in this database.
Definition at line 102 of file TSD.php5.
Referenced by TSDObject::__construct(), TSDService::getAlignmentsByStatus(), TSDText::getListImpl(), TSDStandard::getListImpl(), TSDObject::getListImpl(), TSDRelation::getRelated(), TSDService::getRelationships(), TSDWord::getResourceAlignments(), TSDService::getResourcesAligned(), TSDText::populate(), and TSDStandard::populate().
| static TSD::getLocalDBI | ( | ) | [static] |
| static TSD::getParties | ( | ) | [static] |
Retrieves list of all users who have been granted any permissions.
Users who have been denied all permissions are removed from the database, so they will not show up in this list, even if they had permissions before.
Definition at line 306 of file TSD.php5.
References SObject::getError().
| static TSD::init | ( | ) | [static] |
Initializes the TSD API and connects to the database.
For internal use only.
This method will be called automatically when TSD is first used. You do not need to call it manually.
Definition at line 65 of file TSD.php5.
References SDR::getDBI(), and SConfig::getDefault().
| static TSD::log | ( | $ | description, | |
| $ | query | |||
| ) | [static] |
INSERT BRIEF DESCRIPTION HERE.
INSERT FULL DESCRIPTION HERE
| $description | [TYPE]: DESCRIPTION | |
| $query | [TYPE]: DESCRIPTION |
Definition at line 352 of file TSD.php5.
Referenced by TSDLeaf::align(), TSDLeaf::approveAlignments(), TSDLeaf::cancelAlignments(), and TSDLeaf::unalign().
| static TSD::setPermission | ( | $ | uid, | |
| $ | which, | |||
| $ | how | |||
| ) | [static] |
Modifies permission for user.
| $uid | [int]: user to change permission for | |
| $which | [string]: permission to change; one of: 'edit', 'approve' or 'align' | |
| $how | [boolean]: true if granting the permission, false if revoking |
Definition at line 242 of file TSD.php5.
References SnapPermission::CAP_ALLOW, SConfig::getDefault(), SObject::getError(), Snap2::getLDAP(), SnapDirectory::lookup(), and SConfig::setDefault().
| static TSD::stringToMode | ( | $ | modeString | ) | [static] |
Converts descriptive name of mode to constant value.
Rather than have a thousand pieces of code that convert, e.g., 'devUnapproved' to TSD::MODE_DEV_UNAPPROVED, this function is provided for convenience.
| $modeString | [string]: string description of mode |
Definition at line 328 of file TSD.php5.
References MODE_ALL, MODE_APPROVED, MODE_CHANGED, MODE_DELETED, MODE_DEV, MODE_DEV_ACTIVE, MODE_DEV_UNAPPROVED, MODE_LIVE, and MODE_NEW.
1.5.6