0.1.4-beta.23 • Published 3 years ago

auth-academia-uniandes v0.1.4-beta.23

Weekly downloads
2
License
MIT
Repository
-
Last release
3 years ago

Web Security Academy

This project has several tools for managing security in an Angular Project. It exposes directives and services for getting current user and roles, and showing or hiding components according this information.

Setup

Use npm package manager and execute following command:

npm i auth-academia-uniandes --save

Then import auth-academia-uniandes module in your main module.

    import { AppComponent } from './app.component';
    import { AuthAcademyModule } from 'auth-academia-uniandes';



    @NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        AuthAcademyModule
    ],
    providers: [],
    bootstrap: [AppComponent]
    })
    export class AppModule { }

Use

Once academia-auth module was imported, you can add the directives in your components.

Directives

  • acShowFor: Shows a DOM element for the roles assigned.
    roles = ['PHDSTUDENT', 'PROFESSOR'];
  <ul>
    <li *acShowFor="['ADMINISTRATOR','PROFESSOR','PHDSTUDENT']"> It's visible for  <i>Administrator, Professor and PhdStudent</i></li>
    <li *acShowFor="roles"> It's visible for  <i>Professor and PhdStudent</i></li>
  </ul>
  • acHideFor: Hides a DOM element for the roles assigned.
    roles = ['PHDSTUDENT', 'PROFESSOR'];
  <ul>
    <li *acHideFor="['ADMINISTRATOR','PROFESSOR','PHDSTUDENT']"> It's hide for  <i>Administrator, Professor and PhdStudent</i></li>
    <li *acHideFor="roles"> It's hide for  <i>Professor and PhdStudent</i></li>
  </ul>
  • acReadOnlyFor: Put an input in mode readOnly for the roles assigned.
    roles = ['PHDSTUDENT'];
  <div class="form-group">
      <label class="center-block">Name: (It's read only for Professor)
        <input [acReadOnly]="['PROFESSOR']" class="form-control" formControlName="name">
      </label>
  </div>

  <div class="form-group">
      <label class="center-block">Name: (It's read only for Phd Student)
        <input [acReadOnly]="roles" class="form-control" formControlName="name">
      </label>
  </div>
0.1.4-beta.23

3 years ago

0.1.4-beta.22

3 years ago

0.1.4-beta.21

3 years ago

0.1.4-beta.20

3 years ago

0.1.4-beta.19

3 years ago

0.1.4-beta.16

3 years ago

0.1.4-beta.18

3 years ago

0.1.4-beta.17

3 years ago

0.1.4-beta.15

3 years ago

0.1.4-beta.14

5 years ago

0.1.4-beta.13

5 years ago

0.1.4-beta.12

5 years ago

0.1.4-beta.11

5 years ago

0.1.4-beta.10

5 years ago

0.1.4

5 years ago

0.1.3-rc.15

5 years ago

0.1.3-rc.14

6 years ago

0.1.3-rc.13

6 years ago

0.1.3-rc.12

6 years ago

0.1.3-rc.11

6 years ago

0.1.3-rc.10

6 years ago

0.1.3-rc.9

6 years ago

0.1.3-rc.8

6 years ago

0.1.3-rc.7

6 years ago

0.1.3-rc.6

6 years ago

0.1.3-rc.5

6 years ago

0.1.3-rc.4

6 years ago

0.1.3-rc.3

6 years ago

0.1.3-rc.2

6 years ago

0.1.3-RC1

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.1-RC4

6 years ago

0.1.1-RC3

6 years ago

0.1.1-RC2

6 years ago

0.1.1-RC1

6 years ago

0.1.0-RC8

6 years ago

0.1.0-RC7

6 years ago

0.1.0-RC6

6 years ago

0.1.0-RC5

6 years ago

0.1.0-RC4

6 years ago

0.1.0-RC3

6 years ago

0.1.0-RC2

6 years ago

0.1.0-RC1

6 years ago

0.0.0-SNAPSHOT.3

6 years ago

0.0.0-SNAPSHOT.2

6 years ago

0.0.0-SNAPSHOT.1

6 years ago

0.0.0

6 years ago