
Recherche avancée
Médias (91)
-
Spitfire Parade - Crisis
15 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Audio
-
Wired NextMusic
14 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
-
Sintel MP4 Surround 5.1 Full
13 mai 2011, par
Mis à jour : Février 2012
Langue : English
Type : Video
-
Carte de Schillerkiez
13 mai 2011, par
Mis à jour : Septembre 2011
Langue : English
Type : Texte
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (65)
-
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Récupération d’informations sur le site maître à l’installation d’une instance
26 novembre 2010, parUtilité
Sur le site principal, une instance de mutualisation est définie par plusieurs choses : Les données dans la table spip_mutus ; Son logo ; Son auteur principal (id_admin dans la table spip_mutus correspondant à un id_auteur de la table spip_auteurs)qui sera le seul à pouvoir créer définitivement l’instance de mutualisation ;
Il peut donc être tout à fait judicieux de vouloir récupérer certaines de ces informations afin de compléter l’installation d’une instance pour, par exemple : récupérer le (...) -
Organiser par catégorie
17 mai 2013, parDans MédiaSPIP, une rubrique a 2 noms : catégorie et rubrique.
Les différents documents stockés dans MédiaSPIP peuvent être rangés dans différentes catégories. On peut créer une catégorie en cliquant sur "publier une catégorie" dans le menu publier en haut à droite ( après authentification ). Une catégorie peut être rangée dans une autre catégorie aussi ce qui fait qu’on peut construire une arborescence de catégories.
Lors de la publication prochaine d’un document, la nouvelle catégorie créée sera proposée (...)
Sur d’autres sites (4334)
-
How to verify user permissions – Introducing the Piwik Platform
9 novembre 2014, par Thomas Steur — DevelopmentThis is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to make your plugin multilingual). This time you’ll learn how to verify user permissions. For this tutorial you will need to have basic knowledge of PHP and the Piwik platform.
When should a plugin verify permissions ?
Usually you want to do this before executing any action – such as deleting or fetching data – and before rendering any sensitive information that should not be accessible by everyone. For instance in an API method or Controller action. You sometimes also need to verify permissions before registering menu items or widgets.
How does Piwik’s user management work ?
It is quite simple as it only differentiates between a few roles : View permission, Admin permission and Super User permission. If you manage multiple websites with Piwik a user can be assigned to different roles as a user might have no permission for some websites but view or admin permission for another set of websites.
Worth mentioning is that roles inherit from each other. This means the role admin automatically includes the role view and a super user automatically covers the view and admin role.
Getting started
In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.
Verifying user permissions
To protect your data the platform offers many convenient methods in the \Piwik\Piwik class. There you will find methods that either start with
check
,is
orhas
. While methods that start withcheck
throw an exception in case a condition is not met, the other methods return a booleantrue
orfalse
.Use methods that throw an exception if you want to stop any further execution in case a user does not have an appropriate role. The platform will catch the exception and display an error message or ask the user to log in.
- public function deleteAllMessages()
- {
- // delete messages only if user has super user access, otherwise show an error message
- Piwik::checkUserSuperUserAccess();
- $this->getModel()->deleteAllMessages();
- }
Use methods that return a boolean for instance when registering menu items or widgets.
- public function configureAdminMenu(MenuAdmin $menu)
- {
- if (Piwik::hasUserSuperUserAccess()) {
- $menu->addPlatformItem('Plugins', $this->urlForDefaultAction());
- }
- }
It is important to be aware that just because the menu item won’t be displayed in the UI a user can still open the registered URL manually. Therefore you have to check for permissions in the actual controller action as well.
View permission
A user having a view permission should be only able to view reports but not make any changes apart from his personal settings. The methods that end with
UserHasSomeViewAccess
make sure a user has at least view permission for one website whereas the methods*UserHasViewAccess($idSites = array(1,2,3))
check whether a user has view access for all of the given websites.- Piwik::checkUserHasSomeViewAccess();
As a plugin developer you would usually use the latter example to verify the permissions for specific websites. Use the first example in case you develop something like an “All Websites Dashboard” where you only want to make sure the user has a view permission for at least one website.
Admin permission
A user having an admin permission cannot only view reports but also change website related settings. The methods to check for this role are similar to the ones before, just swap the term
View
withAdmin
.- Piwik::checkUserHasSomeAdminAccess();
Super user permission
A user having the super user permission is allowed to access all of the data stored in Piwik and change any settings. To check if a user has this role use one of the methods that end with
UserSuperUserAccess
.Piwik::checkUserHasSuperUserAccess();
As a plugin developer you would check for this permission for instance in places where your plugin shows an activity log over all users or where it offers the possibility to change any system wide settings.
Getting information about the currently logged in user
Sometimes you might want to know which user is currently logged in. This can be useful if you want to persist user related information in the database or if you want to send an email to the currently logged in user. You can easily get this information by calling the following methods :
- $login = Piwik::getCurrentUserLogin()
- $email = Piwik::getCurrentUserEmail()
Advanced features
Of course there is more that you can do. For instance you can verify whether a user is an anonymous user or whether a user has a specific role. You can also perform any operation in the context of a super user even if the current user does not have this role. Would you like to know more about those features ? Check out the Piwik class reference, the Security guide and the Manage Users user guide.
If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.
-
avcodec/opus : Check count of ambisonic channels
17 février 2017, par Michael Niedermayeravcodec/opus : Check count of ambisonic channels
https://tools.ietf.org/html/draft-ietf-codec-ambisonics-01#section-3.1
specifies the maximum as 227Signed-off-by : Michael Niedermayer <michael@niedermayer.cc>
-
How to verify user permissions – Introducing the Piwik Platform
9 novembre 2014, par Thomas Steur — DevelopmentThis is the next post of our blog series where we introduce the capabilities of the Piwik platform (our previous post was How to make your plugin multilingual). This time you’ll learn how to verify user permissions. For this tutorial you will need to have basic knowledge of PHP and the Piwik platform.
When should a plugin verify permissions ?
Usually you want to do this before executing any action – such as deleting or fetching data – and before rendering any sensitive information that should not be accessible by everyone. For instance in an API method or Controller action. You sometimes also need to verify permissions before registering menu items or widgets.
How does Piwik’s user management work ?
It is quite simple as it only differentiates between a few roles : View permission, Admin permission and Super User permission. If you manage multiple websites with Piwik a user can be assigned to different roles as a user might have no permission for some websites but view or admin permission for another set of websites.
Worth mentioning is that roles inherit from each other. This means the role admin automatically includes the role view and a super user automatically covers the view and admin role.
Getting started
In this post, we assume that you have already set up your development environment and created a plugin. If not, visit the Piwik Developer Zone where you’ll find the tutorial Setting up Piwik and other Guides that help you to develop a plugin.
Verifying user permissions
To protect your data the platform offers many convenient methods in the \Piwik\Piwik class. There you will find methods that either start with
check
,is
orhas
. While methods that start withcheck
throw an exception in case a condition is not met, the other methods return a booleantrue
orfalse
.Use methods that throw an exception if you want to stop any further execution in case a user does not have an appropriate role. The platform will catch the exception and display an error message or ask the user to log in.
- public function deleteAllMessages()
- {
- // delete messages only if user has super user access, otherwise show an error message
- Piwik::checkUserSuperUserAccess();
- $this->getModel()->deleteAllMessages();
- }
Use methods that return a boolean for instance when registering menu items or widgets.
- public function configureAdminMenu(MenuAdmin $menu)
- {
- if (Piwik::hasUserSuperUserAccess()) {
- $menu->addPlatformItem('Plugins', $this->urlForDefaultAction());
- }
- }
It is important to be aware that just because the menu item won’t be displayed in the UI a user can still open the registered URL manually. Therefore you have to check for permissions in the actual controller action as well.
View permission
A user having a view permission should be only able to view reports but not make any changes apart from his personal settings. The methods that end with
UserHasSomeViewAccess
make sure a user has at least view permission for one website whereas the methods*UserHasViewAccess($idSites = array(1,2,3))
check whether a user has view access for all of the given websites.- Piwik::checkUserHasSomeViewAccess();
As a plugin developer you would usually use the latter example to verify the permissions for specific websites. Use the first example in case you develop something like an “All Websites Dashboard” where you only want to make sure the user has a view permission for at least one website.
Admin permission
A user having an admin permission cannot only view reports but also change website related settings. The methods to check for this role are similar to the ones before, just swap the term
View
withAdmin
.- Piwik::checkUserHasSomeAdminAccess();
Super user permission
A user having the super user permission is allowed to access all of the data stored in Piwik and change any settings. To check if a user has this role use one of the methods that end with
UserSuperUserAccess
.Piwik::checkUserHasSuperUserAccess();
As a plugin developer you would check for this permission for instance in places where your plugin shows an activity log over all users or where it offers the possibility to change any system wide settings.
Getting information about the currently logged in user
Sometimes you might want to know which user is currently logged in. This can be useful if you want to persist user related information in the database or if you want to send an email to the currently logged in user. You can easily get this information by calling the following methods :
- $login = Piwik::getCurrentUserLogin()
- $email = Piwik::getCurrentUserEmail()
Advanced features
Of course there is more that you can do. For instance you can verify whether a user is an anonymous user or whether a user has a specific role. You can also perform any operation in the context of a super user even if the current user does not have this role. Would you like to know more about those features ? Check out the Piwik class reference, the Security guide and the Manage Users user guide.
If you have any feedback regarding our APIs or our guides in the Developer Zone feel free to send it to us.